jQuery combine toggle with click

here is the code: http://jsfiddle.net/sxqwp/1/ My question is when I press 'close' then press 'toggle' nothing happens, after second click shows text. When I click 'toggle' it hides text then I click 'open' it shows text but when click again 'toggle' it still shows etc. How can I fix this what if something like this? http://jsfiddle.net/sxqwp/6/ $("a").toggle( function () { $('p').animate({width: "200px"}); }, function () { $('p').animate({width: "100px"}); } ); $("a.openA").click(function() { $('p').stop().animate({width: "200px"}); }); $("a.closeA").click(function() { $('p').stop().animate({width: "100px"}); });

以上就是jQuery combine toggle with click的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准