我有一个图片,想要将它分成两部分,现在按钮点击图像,我想只使用按钮。
到目前为止,我所做的演示就在这里
jQuery(document).ready(function()
{
jQuery('.center').click(function()
{
var clicks = 0;//var clicks = jQuery(this).data('clicks');
var width = jQuery(this).outerWidth() / 2;
if (clicks == 0)
{
jQuery(this).find('.left_move').animate({ right : width },{queue:false,duration:600});
jQuery(this).find('.right_move').animate({ left : width },{queue:false,duration:600});
jQuery(this).css({"height": "auto", "overflow":"visible" });
jQuery(this).find('.images_holder').css({"cursor": "auto" });
jQuery(this).find('a').css({"position": "relative","z-index": "102" });
}
else
{
//stopt the animation
}
++clicks;
});
});
答案 0 :(得分:0)
试试这个:
jQuery(document).ready(function() {
jQuery('#sub').click(function(){
move();
});
function move(){
jQuery('.center').click(function(){
var clicks = 0;//var clicks = jQuery(this).data('clicks');
var width = jQuery(this).outerWidth() / 2;
if (clicks == 0) {
jQuery(this).find('.left_move').animate({ right : width },{queue:false,duration:600});
jQuery(this).find('.right_move').animate({ left : width },{queue:false,duration:600});
jQuery(this).css({"height": "auto", "overflow":"visible" });
jQuery(this).find('.images_holder').css({"cursor": "auto" });
jQuery(this).find('a').css({"position": "relative","z-index": "102" });
}
else{
}
++clicks;
});
}
});