0

The source code of my webpage

My code

I want to be able to click on a thumbnail and the get a modal screen with the image. i used php to set the id and class names but it stil isnt working. i looked everywhere to find a solution but cant find any i have tryed this: Why is this jQuery click function not working?. but also this doesnt work the problem isnt with javascript ready function.

$(document).ready(function() {

});

the first 2 querys work when i want to fadeIn the image and the fadeOut when pressed ESC but the last one when i click on my overlay it isnt working please help me.

The one with the red circle isnt working.

Community
  • 1
  • 1

1 Answers1

1

there is an error in the code:

$('#63848').on('click', '#63848', function() { 

this syntax means you are looking fon an element (second selector) inside a parent container (the first one selector). So you can change the parent container to 'body' or what else you want, like this:

$('body').on('click', '#63848', function(event) { 

or just remove the container

$('#63848').on('click', function(event) { 

see a working example here of your scenario: FIDDLE

pumpkinzzz
  • 2,592
  • 2
  • 11
  • 28
  • Even when i put e.preventDefault(); e.stopPropagation(); in it, it still isn't working. But isn't it kinda weird that the other 2 work and only the last one doesn't? – Nanko Prinzhorn May 27 '16 at 08:02
  • event.preventDefault();* event.stopPropagation();* – Nanko Prinzhorn May 27 '16 at 08:09
  • @NankoPrinzhorn i added a working example here: https://jsfiddle.net/kcu0tr0f/1/ . if you're still having issues try reproducing it inside a fiddle so we can help you – pumpkinzzz May 27 '16 at 08:23
  • OKEE it works now..... What i did was making a new class in the div and called when i click on that class go fadeOut and that works.... – Nanko Prinzhorn May 27 '16 at 10:38