我实现了这个真棒codepen到我的网站: https://codepen.io/ccrch/pen/yyarazJQuery的点击目标
$('.display-image')
.on('change', function(){
$(this).children('img').css({'transform': 'scale('+ $(this).attr('data-scale') +')'});
})
.on('mouseover', function(){
$(this).children('img').css({'transform': 'scale('+ $(this).attr('data-scale') +')'});
})
.on('mouseout', function(){
$(this).children('img').css({'transform': 'scale(1)','transition': 'transform .3s ease-out'});
})
.on('mousemove', function(e){
$(this).children('img').css({'transform-origin': ((e.pageX - $(this).offset().left)/$(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top)/$(this).height()) * 100 +'%'});
})
问题是我指定一个漂亮的滑块对象:当浮油过滤目标 http://kenwheeler.github.io/slick/
而且对象'.display-image'不再注册这些点击事件。我如何着手重新定位这个对象?
在滑块中的图像在for循环中产生;所以我需要有唯一的ID。然后,jquery需要查看每个ID或通配符。这是否使它有所不同? – Tincdawg
通配符应该可以工作。 Ex'$('img [name^=“startsWithSomething”]') – Iceman
感谢冰人 - 但这是行不通的。还有其他建议吗? – Tincdawg