1 $('.btn-cart').click(function(e) {
2 e.preventDefault();
3 $('.cartlist').fadeIn().addClass('active');
4 });
5
6 $('.btn-cartlist-close').click(function() {
7 $('.cartlist').removeClass('active').fadeOut();
8 });
1<a onclick='$("#notification").fadeOut(300, function() { $(this).remove(); });' class="notificationClose "><img src="close.png"/></a>
2
1if (!Element.prototype.fadeIn) {
2 Element.prototype.fadeIn = function(){
3 let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
4 func = typeof arguments[0] === 'function' ? arguments[0] : (
5 typeof arguments[1] === 'function' ? arguments[1] : null
6 );
7
8 this.style.opacity = 0;
9 this.style.filter = "alpha(opacity=0)";
10 this.style.display = "inline-block";
11 this.style.visibility = "visible";
12
13 let $this = this,
14 opacity = 0,
15 timer = setInterval(function() {
16 opacity += 50 / ms;
17 if( opacity >= 1 ) {
18 clearInterval(timer);
19 opacity = 1;
20
21 if (func) func('done!');
22 }
23 $this.style.opacity = opacity;
24 $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
25 }, 50 );
26 }
27}
28
29if (!Element.prototype.fadeOut) {
30 Element.prototype.fadeOut = function(){
31 let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
32 func = typeof arguments[0] === 'function' ? arguments[0] : (
33 typeof arguments[1] === 'function' ? arguments[1] : null
34 );
35
36 let $this = this,
37 opacity = 1,
38 timer = setInterval( function() {
39 opacity -= 50 / ms;
40 if( opacity <= 0 ) {
41 clearInterval(timer);
42 opacity = 0;
43 $this.style.display = "none";
44 $this.style.visibility = "hidden";
45
46 if (func) func('done!');
47 }
48 $this.style.opacity = opacity;
49 $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
50 }, 50 );
51 }
52}
53
54// fadeIn with default: 400ms
55document.getElementById(evt.target.id).fadeIn();
56
57// Calls the "alert" function with the message "done!" after 400ms - alert('done!');
58document.getElementById(evt.target.id).fadeIn(alert);
59
60// Calls the "alert" function with the message "done!" after 1500ms - alert('done!');
61document.getElementById(evt.target.id).fadeIn(1500, alert);
62
1if (!Element.prototype.fadeIn) {
2 Element.prototype.fadeIn = function(){
3 let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
4 func = typeof arguments[0] === 'function' ? arguments[0] : (
5 typeof arguments[1] === 'function' ? arguments[1] : null
6 );
7
8 this.style.opacity = 0;
9 this.style.filter = "alpha(opacity=0)";
10 this.style.display = "inline-block";
11 this.style.visibility = "visible";
12
13 let $this = this,
14 opacity = 0,
15 timer = setInterval(function() {
16 opacity += 50 / ms;
17 if( opacity >= 1 ) {
18 clearInterval(timer);
19 opacity = 1;
20
21 if (func) func('done!');
22 }
23 $this.style.opacity = opacity;
24 $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
25 }, 50 );
26 }
27}
28
29if (!Element.prototype.fadeOut) {
30 Element.prototype.fadeOut = function(){
31 let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
32 func = typeof arguments[0] === 'function' ? arguments[0] : (
33 typeof arguments[1] === 'function' ? arguments[1] : null
34 );
35
36 let $this = this,
37 opacity = 1,
38 timer = setInterval( function() {
39 opacity -= 50 / ms;
40 if( opacity <= 0 ) {
41 clearInterval(timer);
42 opacity = 0;
43 $this.style.display = "none";
44 $this.style.visibility = "hidden";
45
46 if (func) func('done!');
47 }
48 $this.style.opacity = opacity;
49 $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
50 }, 50 );
51 }
52}
53