同位素將在腳本中引起冒泡 - 參考您的懸停效果使用ON綁定它們。 http://api.jquery.com/on/
$("p").on("hover", function(){
alert($(this).text());
});
雖然 - 我看你是通過CSS設置它。 - 您可以通過同位素元素循環循環,並專門追加該類以確保其正常工作。或者你可以使用上面的懸停功能來追加或刪除類。
http://isotope.metafizzy.co/docs/extending-isotope.html
$('#container').isotope({
itemSelector: '.element',
itemPositionDataEnabled: true
})
// log position of each item
.find('.element').each(function(){
var position = $(this).data('isotope-item-position');
//APPEND required class here. ensure its on the elements
console.log('item position is x: ' + position.x + ', y: ' + position.y );
});
_同位素將追加和刪除元素從dom – 2012-11-03 00:25:53
^剛剛編輯的帖子 - 所以你也可以看到如何獲得元素的位置 - 它與同位素的棘手 - 因爲列表元素只是翻譯,他們不會像流沙一樣改變位置,所以你不能只需使用$(li.gold')。index() – 2012-11-03 00:36:00
通過了解項目的位置,您可以獲取座標 – 2012-11-03 00:36:41