実簡単な質問 - 私は.live("hover", function
.live機能に「hoverIntent」を追加
$(".highlight").live("hover", function(){
$(this).animate({"width": "454px", "height":"282px", "top: ":"94px", "left":"152px", "margin-top: ":"-94px", "margin-left":"-152px"}, 500);
});
の代わりに、次のコードにブライアンCherneから.hoverIntent pluginを追加するにはどうすればよいここでは完全なコードです:
$(document).ready(function(){
$('#sliding_grid li').hover(function() {
$(this).css('z-index',1).data('origTop',$(this).css('top')).data('origLeft',$(this).css('left')).addClass('highlight');
}, function() {
$(this).css('z-index', 0);
});
$(".highlight").live("hover", function(){
$(this).animate({"width": "454px", "height":"282px", "top: ":"94px", "left":"152px", "margin-top: ":"0", "margin-left":"0"}, 500);
});
$(".highlight").live("mouseout", function(){
$(this).animate({"width": "148px", "height":"90px", "top: ":$(this).data('origTop'), "left":$(this).data('origLeft'), "margin-top: ":"0", "margin-left":"0"}, 500, function(){
$(this).removeClass('highlight');
});
});
});
hernan on githubそれをforkしてプラグインにサポートを追加したので、コードを変更せずにライブイベントにバインドします。 https://github.com/hernan/hoverIntent commit - https://github.com/hernan/hoverIntent/commit/c35a71a92278792d70845c711c41c5b9e909b848 – jBeas