常用的JQuery单击操作汇总

来源:互联网 发布:c语言多进程编程实例 编辑:程序博客网 时间:2024/06/09 18:08

1最好用的点击

$(document).on("click","#enlargeImgId",function(event){
var width = $(this).width();
if(width==100)
{
$(this).width(300);
$(this).height(300);
}
else
{
$(this).width(100);
$(this).height(100);
}

});

后边实际需要而定

2、点击

$("#enlargeImgId").click(function(){
var width = $(this).width();
if(width==100)
{
$(this).width(300);
$(this).height(300);
}
else
{
$(this).width(100);
$(this).height(100);
}

});

3绑定

$("#enlargeImgId").bind("click",function(){
var width = $(this).width();
if(width==100)
{
$(this).width(300);
$(this).height(300);
}
else
{
$(this).width(100);
$(this).height(100);
}

});

原创粉丝点击