Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI show / hide with a slide effect - how to change the slide "back-in" speed

My page contains many OL lists, each showing a selection of links. When each link is clicked, content slides-out to the right. When clicking through each link, the content then slides back-in, then out again.

Here's a Fiddle showing this in action:

http://jsfiddle.net/juxprose/xu3ck/15/

I would like to slow down the "back-in" part of the slide effect, so it matches the speed of the slide-out. You'll see currently it slides back-in very quickly - I'd like to adjust this speed.

Here's the JS part of the code, where the action happens:

$('.trg-open.website-title').click(function (e) {
 e.stopPropagation();
 $('.website-info').hide();
 $(this).next('.website-info').show('slide', {direction: 'left'}, 1400);
});

Any pointers gratefully appreciated, thanks.

like image 388
Dave Avatar asked Jun 26 '13 20:06

Dave


2 Answers

Try this instead of hiding it

$(document).ready(function(){
    $('.trg-open.website-title').click(function (e) {
    e.stopPropagation();
    $('.website-info').hide('slide', {direction: 'left'}, 1400);
    $(this).next('.website-info').stop().show('slide', {direction: 'left'}, 1400);
   });
});

Check Fiddle

like image 94
Sushanth -- Avatar answered Sep 30 '22 20:09

Sushanth --


How about $('.website-info').hide(1400)? That will hide it with exact same speed as you are showing the stuff.

like image 39
Balint Bako Avatar answered Sep 30 '22 22:09

Balint Bako