在同位素定位后找到目标位置

Ste*_*lly 3 jquery jquery-plugins jquery-masonry

我正在使用David Desandros Isotope创建一个新站点,但现在看来我无法使用jquery找到每个元素的位置.具体来说,我正在尝试在悬停上附加工具提示,但通常我想知道如何在Isotope格式化后获取每个锚点的position().

截至目前,每个元素都显示左侧,左侧边距,位置().左侧的"0"以及我能想到的每个其他定位属性.

des*_*dro 8

请参阅itemPositionDataEnabled的同位素文档

$('#container').isotope({
  itemSelector: '.element',
  itemPositionDataEnabled: true
})
// log position of each item
.find('.element').each(function(){
  var position = $(this).data('isotope-item-position');
  console.log('item position is x: ' + position.x + ', y: ' + position.y  );
});
Run Code Online (Sandbox Code Playgroud)

  • +1,信任制造商,我应该有RTFM;) (2认同)