使用Javascript
/**
Bind the onclick only if you hover on the item since we got a lot
of items and several events and plugins to setup on them.
*/
$('.item_container').live('mouseenter',function(e){
$this = $(this);
if (!$this.data('isSetup')) {
$this.click(function(e){
// do magic
return false;
});
[... a lot of other stuff]
$this.data({'isSetup': true});
}
});
当然,当我点击div中的任何地方时,它会执行’do magic’.感谢返回false,如果我点击div中的任何链接,它仍然执行’do magic’并且不会更改页面,这是预期的行为.
最佳答案