我希望能夠定義變量,然後我就可以使用其他事件,如鼠標移開,了mouseenter,點擊等jQuery的變量多個事件
這是當前的代碼:
$('a div')
// Get the width an height of the image
//var $img_width = $(this).children('img').width();
//var $img_height = $(this).children('img').height();
.mouseenter(function() {
alert($img_width)
})
.mouseleave(function() { // Animate the image back to it's original size
alert($img_width);
})
.each(function(index) {
alert($img_width);
});
你能舉出更多的例子嗎?因爲現在你可以'.bind('mouseenter mouseleave',function(){//做某事})。mouseenter()',需要更多關於你的總體目標的信息。 – 2010-07-09 10:40:15