Using JQuery to Make a Slide Effect

by rsegura in Circuits > Software

620 Views, 6 Favorites, 0 Comments

Using JQuery to Make a Slide Effect

temp_2077315213.jpg
temp_-96211897.jpg
We'll learn how to make a simple image slide into show using jQuery. Now, I'm just going to assume you know some basics of HTML5, CSS3, and Javascript. If not - dont worry, I'll explain each step.

Text Editor

temp_1735602856.jpg
temp_-671812775.jpg
temp_-1413012757.jpg
First, open up any type of text editor, or better yet, use web development software if you have it. Just name the document as shown.

Adding Some HTML

temp_1827172010.jpg
temp_-1827471813.jpg
temp_-858074839.jpg
So, before we go any further, lets take a look at what we're doing here.

1.)We include our tags which is where we'll put our html and JavaScript and css.

2.)We include our content from a content delivery network; in our case, google.

The tag basically tells you its job.

Adding in Our Image and Html Code

temp_-1813084142.jpg
Alright, so lets talk about what we did:

1.)We include our


tags which is where our image will seem to apear from.

2.)We then include our image - here i use the link from my example, however you could use any image you want; be creative.

Include Our Style

temp_466832327.jpg
temp_896745650.jpg
temp_1772038543.jpg
temp_-275530208.jpg
Here we include our CSS3 between the tags. CSS - Cascading Style Sheets. Things done:

1.)We change the background of the page's body to dim gray.

syntax:
selector{
property: value;
}

Using this syntax, looking at the code between the tags should become easier.

Include Our Script

temp_1499342090.jpg
temp_-1655256880.jpg
temp_-1174454237.jpg
temp_-2044547160.jpg
We finally add our jQuery! :D We put it between new
tags. Here are some steps:

1.)We select our tag with the id of 'flip' and add the click() function to it.

2.)We get our image with the id of 'jumbotron' and add the slideToggle() function with a parameter of 1000 - 1000 milliseconds (1 second delay)

Save

temp_1050857344.jpg
temp_-2007940660.jpg
temp_-234924025.jpg
temp_-1702984976.jpg
temp_888467072.jpg
temp_1332407600.jpg
Save the document as a html file with .html instead of .txt

Future Edits

You should definitely edit the jQuery and the style of the page :) make it your own and show off your skill. Also use this for your own applications :D