/ / Div slideLeft .. Come slideDown o slideUp - javascript, jquery, html, css

Div slideLeft .. Come slideDown o slideUp - javascript, jquery, html, css

Voglio far scorrereLeft un div con jquery .. Ma come slideDown e slideUp o slideToggle .. Come posso fare?

risposte:

3 per risposta № 1

Ecco un rapido plugin jQuery che potrebbe aiutarti?

jQuery.fn.slideLeftHide = function( speed, callback ) {
this.animate({
width: "hide",
marginLeft: "hide",
marginRight: "hide"
}, speed, callback );
}

jQuery.fn.slideLeftShow = function( speed, callback ) {
this.animate( {
width: "show",
marginLeft: "show",
marginRight: "show"
}, speed, callback );
}

Per essere usato in questo modo:

$("#elemID").slideLeftHide(300);

e a VIOLINO per demonstation!


1 per risposta № 2

Crea un'animazione che usi .animate() per ridurre la larghezza a 0:

$("#my-id").animate({ width : 0 }, 1000); // slide left the div

Scorri a destra è più complicato ...


0 per risposta № 3

Questo può funzionare se il tuo div ha un overflow: nascosto

$("#test").animate({width:0},500,function(){$(this).hide()})