You get a bonus - 1 coin for daily activity. Now you have 1 coin

Does jQuery's SlideUp/SlideDown have a Step property? How can you replace or emulate slideUp with animate?

Practice




is there a Jquery SlideUp SlideDown Step property?
if there is no step, then
how can you replace or emulate slideUp and slideDown using animate?

you can try using animate like this instead of slideDown and slideUp



jQuery.exists = function(selector) {
return ($(selector).length > 0);
}


var isanimated=false;


function myslideDown(selector)
{
if (isanimated) return false;

isanimated=true;



selector.animate({
"height": "show",
"marginTop": "show",
"marginBottom": "show",
"paddingTop": "show",
"paddingBottom": "show"
},
{

step: function( now, fx ) {
// $(this).height();

var data = fx.elem.id + " " + fx.prop + ": " + now;
$( "body" ).append( "
" + data + "
" );


}

,
complete: function(){

console.log( 'DONE!!');isanimated=false;
}


});

}

function myslideUp(selector)
{
if (isanimated) return false;

isanimated=true;

selector.animate({
"height": "hide",
"marginTop": "hide",
"marginBottom": "hide",
"paddingTop": "hide",
"paddingBottom": "hide"
},
{


step: function( now, fx ) {

console.log($(this).height());
var data = fx.elem.id + " " + fx.prop + ": " + now;
$( "body" ).append( "
" + data + "
" );

} ,
complete: function(){
isanimated=false;
}
});

}











});

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone