Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add the autoScroll property

  • Loading branch information...
commit 9a0dc57b56638cc71b06ac1e703174f0c54cb0c9 1 parent 6d1384c
@winktoolkit winktoolkit authored
View
2  changes.txt
@@ -268,6 +268,6 @@ Release 1.4.2 [06/06/2012]
Release 1.4.3 [xx/xx/xxxx]
- Fix syntax issues: unused local variable, prevent non local variable, comma/semicolon syntax errors
- Added a return value to wink.connect
- - Added openMultipleSections option in wink.ui.layout.Accordion. Sections titles can now have a variable height
+ - Added openMultipleSections and autoScroll options in wink.ui.layout.Accordion. Sections titles can now have a variable height
- Added wink.ui.xy.Mask
- Added a timeout parameter to the wink.net.Xhr sendData method
View
25 ui/layout/accordion/js/accordion.js
@@ -47,7 +47,15 @@ define(['../../../../_amd/core'], function(wink)
* @property openMultipleSections
* @type boolean
*/
- this.openMultipleSections = false;
+ this.openMultipleSections = false;
+
+ /**
+ * Scroll automatically one a section is being opened
+ *
+ * @property autoScroll
+ * @type boolean
+ */
+ this.autoScroll = true;
this._sectionsList = [];
@@ -55,6 +63,8 @@ define(['../../../../_amd/core'], function(wink)
this._height = 0;
this._visibleContent = 0;
+ this._animated = false;
+
this._domNode = null;
wink.mixin(this, properties);
@@ -85,7 +95,7 @@ define(['../../../../_amd/core'], function(wink)
this._domNode.appendChild(section.containerNode);
this._updateHeight();
-
+
return section.uId;
},
@@ -180,10 +190,13 @@ define(['../../../../_amd/core'], function(wink)
}
}
- if ( (this._sectionsList[f].TITLE_HEIGHT * this._sectionsList.length) + this._visibleContent > this._height )
+ if ( !this._animated )
{
- this._updateHeight();
+ wink.fx.applyTransition(this._domNode, 'height', this.DURATION + 'ms', '', 'ease-in-out');
+ this._animated = true;
}
+
+ this._updateHeight();
},
/**
@@ -250,6 +263,8 @@ define(['../../../../_amd/core'], function(wink)
{
this._domNode = document.createElement('div');
this._domNode.className = 'w_list w_border_top ac_accordion';
+
+ //wink.fx.applyTransition(this._domNode, 'height', this.DURATION + 'ms', '', 'ease-in-out');
},
/**
@@ -381,7 +396,7 @@ define(['../../../../_amd/core'], function(wink)
wink.fx.translate(this.containerNode, 0, position);
wink.fx.rotate(this.chevronNode, 0);
- if(wink.has('css-transition'))
+ if(wink.has('css-transition') && this._accordion.autoScroll)
{
wink.fx.onTransitionEnd(this.contentNode, wink.bind(this._scroll, this));
}
View
2  ui/layout/accordion/test/test_accordion_2.html
@@ -67,7 +67,7 @@
init = function()
{
- accordion = new wink.ui.layout.Accordion();
+ accordion = new wink.ui.layout.Accordion({autoScroll: false});
wink.byId('output').appendChild(accordion.getDomNode());
Please sign in to comment.
Something went wrong with that request. Please try again.