Funny effect using jQuery.

I was just playing around with jQuery and accidental created this really funny effect. Keeping this post short as I have to get back to work I will post the code here –

<html>
<head>
<script type=”text/javascript” src=”jquery-1.7.js”></script>
<script type=”text/javascript”>
// we will add our javascript code here
$(document).ready(function (){
$(“#mylink”).toggle(function (){
$(“#mydiv”).hide(‘slow’);
}, function() {
$(“#mydiv”).show(‘slow’);
});
});
</script>
</head>
<body>
<a href=”#” id=”mylink”>My link</a>
<div id=”mydiv” align=”center”>This is my div.</div>
</body>
</html>

The code functioned the way it without adding align=”center” in the div tag. However when I added that it gave me a smooth sliding effect 😛

Sadly I do not have a video upgrade, so I cannot post my video here 😦 I urge my readers to copy paste the code and try it out, it should be fun.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s