H
H
h_mray2020-06-07 01:29:45
JavaScript
h_mray, 2020-06-07 01:29:45

At the second zoom, the picture disappears, what should I do?

At first I tried to solve the problem with the disappearance of the picture, the solution was to wrap it in a link. At the first zoom, everything works great, the picture remains in place, but on the second click, the zoom window pops up, but the picture itself does not return. What needs to be fixed so that it does not disappear?
here you can see - jsfiddle.net/o6npy9er/1

<a href="img/mUHCeryGw6Y.jpg" class="img"><img src="img/mUHCeryGw6Y.jpg" class="img"/></a>

$(".img").click(function(){
    $(".img").fancybox();
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-06-07
@h_mray

Why do you have the same class assigned to the link and the picture?
No click handler needed, just call fancybox for the link: . $('a').fancybox();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question