Jump to content

Are there any JS functions that activate JS when element is in view?


612wharfavenue

Recommended Posts

I want an element to respond onclick, but only when its in a certain part of the screen, like a 'active area'. Does anyone know of any built in functions or methods that can do this? The element is capable of being moved about the page, and i would like its onclick event only to be active when its entirely within the designated 'box', which is invisible.

Link to comment
Share on other sites

i am not aware about any any built in mehtods but you can do something like this.you can create a function which will take the x and y co-ordinate of the movable elementcheck those co-ordinates against some predefined co-ordinate (criteria fixed by you) of that element where it iss clickableif criteria matches do some jobnow you can bound the function to any event eg. onclick int that element.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...