我总是对打开/关闭按钮感到困惑。
这可能是一种错误的方式--但我似乎无法运行第二个替代。
还有其他我应该用的东西吗?谢谢
$(currentSlideHtmlObject).find('.openSpec').on('click',
function (e){
e.preventDefault();
$techSpec.animate({
left : '-' + $techSpec.outerWidth() + 'px'
});
},
function (e) {
e.preventDefault();
$techSpec.animate({
left : '0px'
});
}
);发布于 2012-11-03 21:57:18
你要找的是toggle,不是on
$("#target").toggle(
function() {
console.log("On");
},
function() {
console.log("Off");
}
);Live Example | Source
https://stackoverflow.com/questions/13209801
复制相似问题