The cloud-zoom plug-in I use. The internal structure is as follows
a标签插件里面有个点击事件
if($(this).is('.cloud-zoom-gallery')) {
opts = $.extend({}, c, d); $(this).data('relOpts', opts); $(this).bind('click', $(this), function(a) { var b = a.data.data('relOpts'); $('#' + b.useZoom).data('zoom').destroy(); $('#' + b.useZoom).attr('href', a.data.attr('href')); $('#' + b.useZoom + ' img').attr('src', a.data.data('relOpts').smallImage); $('#' + a.data.data('relOpts').useZoom).CloudZoom(); return false }) 然后我写的li的事件就失效了。 上面也没阻止这个冒泡事件啊。我把return false去掉就可以了。但是A标签会造成页面的跳转。我又把href改成了别的属性、这样会不会某些地方出错。 或者有没有别的方法可以让li的事件触发。
To prevent the default event of a tag, you can use event.preventdefault()
http://www.w3school.com.cn/js...
An article is written like the picture above
return false
Don’t use it casually, write whatever you want to prevent, and don’t let bad habits make you step on your own mistakes in the futureFor details, please check
http://www.jb51.net/article/4...
If you don’t want to jump, use
No, it will be fine. If you
return false
in the event, the event will be invalid.