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前端其它相关文章!