Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery slide left and show

Tags:

jquery

effects

I extended the jQuery effects called slideRightShow() and slideLeftHide() with a couple functions that work similarly to slideUp() and slideDown() as seen below. However, I would also like to implement slideLeftShow() and slideRightHide().

I know there are substantial libraries that offer this type of thing (I'd like to avoid adding another large set of javascript files), but can anyone provide a simple example of how to implement either slideLeftShow() or slideRightHide()?

jQuery.fn.extend({   slideRightShow: function() {     return this.each(function() {       jQuery(this).animate({width: 'show'});     });   },   slideLeftHide: function() {     return this.each(function() {       jQuery(this).animate({width: 'hide'});     });   },   slideRightHide: function() {     return this.each(function() {       ???     });   },   slideLeftShow: function() {     return this.each(function() {       ???     });   } }); 

The above slideRightShow function starts showing the image from the left side and it progresses toward the right side. I am looking for some way to do the same thing but start from the right side and progress toward the left. Thanks!

EDIT

jQuery Interface has something like I need (I basically need their "slide in right" and "slide out left" functions), but I couldn't get this to work with jQuery 1.3: http://interface.eyecon.ro/demos/ifx.html . Also, their demo seems to broken as well as it will only do a slide once before throwing a million errors.

like image 565
Wickethewok Avatar asked Feb 06 '09 17:02

Wickethewok


People also ask

How do you create a left and right toggle effect in jQuery slide?

The task here is to create a slide left and right toggle effect in the JQuery, you can use the jQuery animate() method. . animate() method: It is used to change the CSS property to create the animated effect for the selected element.

How do you toggle slideUp and slideDown in jQuery?

The slideToggle() method toggles between slideUp() and slideDown() for the selected elements. This method checks the selected elements for visibility. slideDown() is run if an element is hidden. slideUp() is run if an element is visible - This creates a toggle effect.

How do you move slides from left to right?

In the pane on the left, click the thumbnail of the slide that you want to move, and then drag it to the new location.


1 Answers

This feature is included as part of jquery ui http://docs.jquery.com/UI/Effects/Slide if you want to extend it with your own names you can use this.

jQuery.fn.extend({   slideRightShow: function() {     return this.each(function() {         $(this).show('slide', {direction: 'right'}, 1000);     });   },   slideLeftHide: function() {     return this.each(function() {       $(this).hide('slide', {direction: 'left'}, 1000);     });   },   slideRightHide: function() {     return this.each(function() {       $(this).hide('slide', {direction: 'right'}, 1000);     });   },   slideLeftShow: function() {     return this.each(function() {       $(this).show('slide', {direction: 'left'}, 1000);     });   } }); 

you will need the following references

<script src="http://code.jquery.com/jquery-latest.js"></script> <script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/jquery.effects.core.js"></script> <script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/jquery.effects.slide.js"></script> 
like image 144
bendewey Avatar answered Sep 23 '22 01:09

bendewey