开发者

jQuery .animate({ 'width' : 'show' }) doesn't work properly in Chrome/Safari?

开发者 https://www.devze.com 2023-04-01 23:54 出处:网络
This piece of code works in Firefox and IE: $(\'input\').click(function() { $(group).animate({ \'width\' : \'show\'

This piece of code works in Firefox and IE:

$('input').click(function() {       
    $(group).animate({
        'width' : 'show'
   开发者_运维知识库 }, 2000, "easeInOutCirc");

});

However, in webkit browsers (Chrome and Safari), it doesn't. But if I use $(group).show();, it works in all browsers.

What could be the problem?


please change this

'width' : 'show'

to

'width' :  'toggle'

or use

"opacity": "show"


I found the solution to my question. For some reason, I needed to set the css property in jQuery instead of just hiding $(group) via .hide(). So what I did was to put this line of code at the beginning:

$(group).css("display","none");

instead of

$(group).hide();

Now it works. Anyway, thanks for the input!

0

精彩评论

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