_ScrollableMixin.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.mobile._ScrollableMixin"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.mobile._ScrollableMixin"] = true;
  8. dojo.provide("dojox.mobile._ScrollableMixin");
  9. dojo.require("dijit._WidgetBase");
  10. dojo.require("dojox.mobile.scrollable");
  11. // summary:
  12. // Mixin for widgets to have a touch scrolling capability.
  13. // description:
  14. // Actual implementation is in scrollable.js.
  15. // scrollable.js is not a dojo class, but just a collection
  16. // of functions. This module makes scrollable.js a dojo class.
  17. dojo.declare(
  18. "dojox.mobile._ScrollableMixin",
  19. null,
  20. {
  21. fixedHeader: "",
  22. fixedFooter: "",
  23. destroy: function(){
  24. this.cleanup();
  25. this.inherited(arguments);
  26. },
  27. startup: function(){
  28. var params = {};
  29. if(this.fixedHeader){
  30. params.fixedHeaderHeight = dojo.byId(this.fixedHeader).offsetHeight;
  31. }
  32. if(this.fixedFooter){
  33. var node = dojo.byId(this.fixedFooter);
  34. if(node.parentNode == this.domNode){ // local footer
  35. this.isLocalFooter = true;
  36. node.style.bottom = "0px";
  37. }
  38. params.fixedFooterHeight = node.offsetHeight;
  39. }
  40. this.init(params);
  41. this.inherited(arguments);
  42. }
  43. });
  44. (function(){
  45. var obj = new dojox.mobile.scrollable();
  46. dojo.extend(dojox.mobile._ScrollableMixin, obj);
  47. if(dojo.version.major == 1 && dojo.version.minor == 4){
  48. // dojo-1.4 had a problem in inheritance behavior. (#10709 and #10788)
  49. // This is a workaround to avoid the problem.
  50. // There is no such a problem in dojo-1.3 and dojo-1.5.
  51. dojo.mixin(dojox.mobile._ScrollableMixin._meta.hidden, obj);
  52. }
  53. })();
  54. }