开发者

tween back to auto-height with xuijs

I'm having problems to create a equivalent slideDown for xuijs.

The slideUp (hide) is easily done with

x$('elm').tween(开发者_如何学编程{height:'0'});

but there seem to be no way to revert back to original height using tween.

$x('elm').setStyle('height','auto !important');

works fine but no animation of course,

x$('elm').tween({height:'auto !important'});

does not work. (setting height to fixed value does however, but that's not an option).

Kind of stuck here, document.getElementById('target_box').clientHeight doesn't help either once the height is set to 0 by tween or setStyle. Only solution I can think of is storing the heights in an array before initial global collapse of divs.

thankful for any help.

(the divs affected uses overflow: hidden)

regards,

//t


If you're using html5 Why not store the height as a data- attribute before you call tween?

x$.extend({
 'slideUp' : function(){
    this = this[0];
    x$(this).attr('data-h',this.clientHeight);
    x$(this).tween({height:'0'});
 },
 'slideDown' : function(){   
     this = this[0];   
     x$(this).tween({height:x$(this).attr('data-h');});     
  }
});

this code is untested, but it's worth a shot.


Not sure if you have solved this but I got a solution. Pretty sure there are better ways but this seemed to do the trick.

emile.js and xui animation needing double click?

uses emile instead of tween but sure you could change it if you want however emile.js is in xui.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜