I have a script where i click an image to zoom it in, but i would the user to be able to click outside the image to close it.
i noticed though that if i set a function to the body
$(body).click(function{ closeImage(); })
is going ot be a conflict between that function and the regular function i created for the image (let’s call it openImage(); just for example’s sake)…
there is any way to select the “remaining area” so it is the only portion of the screen that can fire closeImage(); ?
UPDATE: to clarify my problem: if i set a function on the boy and then i click the image, the image doesnt zoom anymore because it conflicts with the body function
See this answer for how to attach an event handler both to the body and the element, but cancel the event bubbling so that the body handler does not fire for particular sub-handlers.