0
바인딩이 충돌하지 않도록이 코드를 어떻게 다시 작성합니까? 마우스를 올리면 대상 그림을 클릭하면 반응을 멈추는 스케일이 있습니다 (Youtube 비디오를 나타 내기 위해).jquery 바인딩이 충돌합니다.
<script type="text/javascript">
//to scale up on hover
$('#videoandmapwrap').on({
mouseenter: function() {
current_h = $(this, 'img')[0].height;
current_w = $(this, 'img')[0].width;
$(this).stop(true, false).animate({
width: (current_w * 2.7),
height: (current_h * 2.7)
}, 900);
},
mouseleave: function() {
$(this).stop(true, false).animate({
width: current_w + 'px',
height: current_h + 'px'
}, 400);
}
}, 'img');
//to reveal from behind placeholder picture
$('#videoandmapwrap').on("click","img",function(event){
event.preventDefault();
video = '<iframe class="piccon" width="200" height="200" src="'+ $(this).attr('data-video') +'"></iframe>';
$(this).replaceWith(video);
});
</script>
이벤트 위임을 사용하여 코드를 다시 작성하는 것이 문제를 해결할 것으로 생각되었지만 그렇지 않았습니다. 미리 감사드립니다! – Vynce82