-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpictureAnimation.html
More file actions
39 lines (37 loc) · 1.26 KB
/
pictureAnimation.html
File metadata and controls
39 lines (37 loc) · 1.26 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
<!Doctype HTML>
<html>
<head>
<meta charset="utf-8" />
<title> jQuery exercises </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("img[name='img']").bind("click", function (event) {
if ($(event.target).parent().css('text-align') == 'left'){
$(event.target).parent().css("text-align", "center");
$(event.target).animate ({
width: $(event.target).width() * 3,
height: $(event.target).height() * 3,
}, 2500);}
else if ($(event.target).parent().css('text-align') == 'center'){
$(event.target).parent().css("text-align", "left");
$(event.target).animate ({
width: $(event.target).width() / 3,
height: $(event.target).height() / 3,
}, 2500);
}
});
});
</script>
</head>
<body>
<p name="picture" style="text-align: left">
<img src="https://www.engineyard.com/hs-fs/hubfs/Blog%20Images/Jquery.jpg?t=1535132512246&width=450&name=Jquery.jpg"
name="img" width="200">
</p>
<p name="picture" style="text-align: left">
<img src="https://www.onlinetutz.com/wp-content/uploads/2016/08/Hi5ESio.jpg"
name="img" width="200">
</p>
</body>
</html>