Tag: free stuff


jQuery Animate

19th May

Here I will mention how to use the jquery animate function and the usability and flexibility of it.
The syntax of this function is:

$.animate(options, settings, callback);
/* you can replace setting with duration (in milliseconds) or words: ‘slow’, ‘normal’ or ‘fast’.
callback is optional */

Below is a list of popular and most used animation:

increasing/decreasing width and height
moving or scrolling html element
changing opacity
scrolling window

Now let me explain each in an example.


Scroll window smoothly using jQuery

26th March

Using jQuery animate() function to do a smooth scrolling:

I have also created a div as follow:

<div id=”scrollToHere”>
Scroll to here
</div>

You need something to run your script. Create a button like this:

<input type=”button” onclick=”scollWin();” value=”Scroll up” />

The jQuery Code will be like this:

function scrollWin(){
$(‘html,body’).animate({
scrollTop: $(“#scrollToHere”).offset().top
}, 800);
}

Here is something to try:

now jQuery window scrolling is done with animation.

Enjoy it..


Better way to load XML document with Javascript

31st December

The better way to load XML document on all browsers is to use AJAX technique.

After testing XML with Javascript. I fount that Safari (on Mac OSX 10) does not support XML with Javascript.
So, How to load it then?