我正在通過ajax加載一些內容,並且需要使用live()
函數。既然下面的插件有屬性來設置你如何設置它以使用live()
?如何在此插件上使用jQuery .live
$(function() {
$("#book-wrapper .books").hoverIntent({
over: enter,
out: leave,
interval: 200
});
});
function enter() { $(this).animate({ width: '+=115px' }, 350, 'swing'); $(".slide-out", this).animate({ opacity: 1 }, 450, 'swing'); }
function leave() { $(this).animate({ width: '-=115px' }, 350, 'swing'); $(".slide-out", this).animate({ opacity: 0.0 }, 450, 'swing'); }
你是不是想給'hoverIntent'方法添加到所有新的'.books'? – philwinkle 2011-03-09 05:54:58
@philwinkle,是的,在頁面加載時,不會有類型爲「.books」的元素。他們將通過ajax加載,然後我需要他們對hoverIntent做出反應。 – 2011-03-09 05:56:02