-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheventsjs.js
More file actions
60 lines (51 loc) · 1.86 KB
/
eventsjs.js
File metadata and controls
60 lines (51 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//First way to use evenets using normal function in jquery
// $("#btn2").click(list); // if here do change() it will not wait for to click it will directly make changes
// function list() {
// $("li:odd").fadeToggle();
// }
// $("#btn2").click(function () {
// // anonymous function
// $("li:odd").fadeToggle();
// });
/*basically ready is used if there are various components in a document and we have applied functionalities
to button lets say so if button loads first then it will execute its operation before other content loading
so ready comes in to firsts load the whole document */
$(document).ready(function () {
// here document refers to documeht as a whole
/* this is used when we want our page to start working once the whole document is loaded and ready for
the next request cycle to complete before the next request*/
$("#btn2").click(function () {
// anonymous function
$("li:odd").fadeToggle();
});
$("#btn1").dblclick(function () {
// anonymous function
$("#img1").css("height", "600px");
$("#img1").css("width", "800px");
});
});
$("img").mouseenter(function () {
$("#img1").css("height", "500px");
$("#img1").css("width", "600px");
});
$("img").mouseleave(function () {
$("#img1").css("height", "300px");
$("#img1").css("width", "500px");
});
// but this require two different function as well as two different events
// we can do this by just one event of jquery
$("img").hover(
function () {
$("#img1").css("height", "500px");
$("#img1").css("width", "600px");
},
function () {
$("#img1").css("height", "300px");
$("#img1").css("width", "500px");
}
);
/* there are more other events in jquery
mouse events = click,dblclick,mouseenter,mouseleave
keyboardevents =keypress, keydown ,MediaKeyStatusMap
form events =submit, change, focus, blur
document / window events = load,resize,scroll,unload*/