Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

on click fade out jquery

$(document).ready(function(){
  $("button").click(function(){
    $("p").fadeOut(2500);
  });
});
Comment

jquery on click fade out element

$(document).ready(function(){
  $("button").click(function(){
    $("p").fadeOut();
  });
});
Comment

fadein fadeout jquery

	$('.btn-cart').click(function(e) {
		e.preventDefault();
		$('.cartlist').fadeIn().addClass('active');
	});

	$('.btn-cartlist-close').click(function() {
		$('.cartlist').removeClass('active').fadeOut();
	});
Comment

jquery fadeout and remove

<a onclick='$("#notification").fadeOut(300, function() { $(this).remove(); });' class="notificationClose "><img src="close.png"/></a>
Comment

jquery fade out

$(selector).fadeOut(duration)
$(selector).fadeIn(duration)
Comment

jquery fadeout to fadein

$('#ToHide').fadeOut(function () { $('#ToShow').fadeIn(); });
Comment

javascript fadeout without jquery

if (!Element.prototype.fadeIn) {
    Element.prototype.fadeIn = function(){
        let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
            func = typeof arguments[0] === 'function' ? arguments[0] : (
                typeof arguments[1] === 'function' ? arguments[1] : null
            );

        this.style.opacity = 0;
        this.style.filter = "alpha(opacity=0)";
        this.style.display = "inline-block";
        this.style.visibility = "visible";

        let $this = this,
            opacity = 0,
            timer = setInterval(function() {
            opacity += 50 / ms;
            if( opacity >= 1 ) {
                clearInterval(timer);
                opacity = 1;

                if (func) func('done!');
            }
            $this.style.opacity = opacity;
            $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
        }, 50 );
    }
}

if (!Element.prototype.fadeOut) {
    Element.prototype.fadeOut = function(){
        let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
            func = typeof arguments[0] === 'function' ? arguments[0] : (
                typeof arguments[1] === 'function' ? arguments[1] : null
            );

        let $this = this,
            opacity = 1,
            timer = setInterval( function() {
            opacity -= 50 / ms;
            if( opacity <= 0 ) {
                clearInterval(timer);
                opacity = 0;
                $this.style.display = "none";
                $this.style.visibility = "hidden";

                if (func) func('done!');
            }
            $this.style.opacity = opacity;
            $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
        }, 50 );
    }
}

// fadeIn with default: 400ms
document.getElementById(evt.target.id).fadeIn();

// Calls the "alert" function with the message "done!" after 400ms - alert('done!');
document.getElementById(evt.target.id).fadeIn(alert);

// Calls the "alert" function with the message "done!" after 1500ms - alert('done!');
document.getElementById(evt.target.id).fadeIn(1500, alert);
Comment

javascript fadeout without jquery

if (!Element.prototype.fadeIn) {
    Element.prototype.fadeIn = function(){
        let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
            func = typeof arguments[0] === 'function' ? arguments[0] : (
                typeof arguments[1] === 'function' ? arguments[1] : null
            );

        this.style.opacity = 0;
        this.style.filter = "alpha(opacity=0)";
        this.style.display = "inline-block";
        this.style.visibility = "visible";

        let $this = this,
            opacity = 0,
            timer = setInterval(function() {
            opacity += 50 / ms;
            if( opacity >= 1 ) {
                clearInterval(timer);
                opacity = 1;

                if (func) func('done!');
            }
            $this.style.opacity = opacity;
            $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
        }, 50 );
    }
}

if (!Element.prototype.fadeOut) {
    Element.prototype.fadeOut = function(){
        let ms = !isNaN(arguments[0]) ? arguments[0] : 400,
            func = typeof arguments[0] === 'function' ? arguments[0] : (
                typeof arguments[1] === 'function' ? arguments[1] : null
            );

        let $this = this,
            opacity = 1,
            timer = setInterval( function() {
            opacity -= 50 / ms;
            if( opacity <= 0 ) {
                clearInterval(timer);
                opacity = 0;
                $this.style.display = "none";
                $this.style.visibility = "hidden";

                if (func) func('done!');
            }
            $this.style.opacity = opacity;
            $this.style.filter = "alpha(opacity=" + opacity * 100 + ")";
        }, 50 );
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: loop through array javascript 
Javascript :: react public pic 
Javascript :: distance to km javascript 
Javascript :: countdown timer in react js 
Javascript :: how to run function after animation complete jquery 
Javascript :: calculate width of text javascript 
Javascript :: javascript long integer 
Javascript :: jquery check if input is empty 
Javascript :: vs code shows bodyparser deprecated 
Javascript :: reload react native app 
Javascript :: add text to string javascript 
Javascript :: how to hide react navigation header in react native 
Javascript :: react router dom v6 active link 
Javascript :: $lookup in mongodb 
Javascript :: display content in a modal react 
Javascript :: how to use useparams in react 
Javascript :: redis nodejs 
Javascript :: @input and @output in angular 
Javascript :: urlencoded limit express 
Javascript :: javascript split string into array by comma 
Javascript :: multipline and single line regex pattern 
Javascript :: how to change the color of a console.log in javascript 
Javascript :: javascript browser tab active 
Javascript :: .join in javascript 
Javascript :: npm react copy to clipboard 
Javascript :: count the number of elements in an array javascript 
Javascript :: js get element by index 
Javascript :: remove repeated characters from a string in javascript 
Javascript :: javascript convert object to querystring 
Javascript :: open sans font react js 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =