JavaScript Events
jQuery plugins are Javascriot file swhich perform specific functions.
For example,If we import a datepicker jQuery plugin,
We must write
$("#date_picker").datepicker({
format:"mm/dd/YYYY")
});
Events:
There are several events that can happen while browsing a web page.
For e.g.,
There are several events that can happen while browsing a web page.
For e.g.,
- User can press a key
- a user can double click in an element
- a user enters an section of a web page
- a user drags an element
- a user drops an element
- a user scrolls down or up
The syntax for event handlers is as follows: |
---|
onkeypress |
onkeydown |
onkeyup |
onmouserover |
onmouseenter |
onmouseleave |
ondragover |
ondrop |
onscroll |
onload |
onbeforeload |
onunload |
onbeforeunload |
ondblclick |
onsubmit |
onclick |
Sometimes, we want to add some style or hide our HTML elements while the user is scrolling the web page up or down (horizontal also)
The scrollTop is a metric and a variable which stores the currebnt top positiomn of the web page with respect to the original top position befire the scrolling
For Example, consider the code below
The bubbling of events is the phenomenon in which the parent for which the element is triggered, for all its ancestors including its parents, the events is triggered
Comments
Post a Comment