Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Slide effect with jquery-ui?

I have the following code so far but not sure how I can use jquery slide effect on an image I'm loading in a <div>.

.js I have loaded so far

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="jqueryui.js"></script>

The HTML code is

<div align="center"><img src="images/personal_photo.png" width="900" height="850" alt="Awesome effects"></div>

Note: Since I dont know how to apply the jquery-ui effects I have not done anything with the code.

like image 427
Chirag Avatar asked Jan 16 '11 01:01

Chirag


People also ask

What is jQuery slide function?

The jQuery slideToggle() method toggles between the slideDown() and slideUp() methods. If the elements have been slid down, slideToggle() will slide them up. If the elements have been slid up, slideToggle() will slide them down. $(selector). slideToggle(speed,callback);

How do you toggle slideUp and slideDown in jQuery?

jQuery slideToggle() Method 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 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.


1 Answers

If you want to show the object and you want the slide towards the left, then you have to reverse the direction of the slide.

something like the following:

$("img").click(function () {
    $(this).show("slide", { direction: "right" }, 1000); 
});
like image 168
Mike Avatar answered Sep 20 '22 16:09

Mike