第二個函數不起作用?不能讓jquery懸停使用.live()
$('.edit_hover').live('hover',
function(e){
$(this).stop();
var half_width = ($(this).css('width').slice(0, -2))/2;
var half_height = ($(this).css('height').slice(0, -2))*0.3;
console.log(half_width);
var top = ($(this).position().top) + half_height;
var left = ($(this).position().left) + half_width;
$('#edit_hover').css('top', top).css('left', left).fadeIn(300);
//add overlay
$(this).css('position', 'relative').append('<div class="edit_overlay" style="position: absolute; top:0px; left:0px; height:100%; width: 100%; background: #999; opacity: 0.5;"></div> ')
},
function(){
$(this).stop();
$(this).find('.edit_overlay').remove();
$('#edit_hover').fadeOut(300);
});
+1謝謝!注意:我必須將'mouseover'更改爲'mouseenter',才能使腳本的第二部分工作。 – ILoveBrisbane 2011-03-24 11:53:03
@ILoveBrisbane:對。 'hover'綁定'mouseenter'和'mouseleave',而不是'mouseover'。感謝您指出這一點....修正:) – 2011-03-24 13:36:23
仍然似乎在1.6.2的情況 – mplungjan 2011-09-01 13:50:45