Reputation: 29
what does this function do?
function topRise() {
$(".topRise").animate({
top: "-900px"
}, 25000, topSet);
};
Upvotes: 1
Views: 201
Reputation: 74738
what does this function do?
function topRise() {
$(".topRise").animate({
top: "-900px"
}, 25000, topSet);
};
See your function has a jQuery selector and a method named .animate()
bound on it.
so get it line by line:
$(".topRise")
is the selector which are elements with class name topRise
..animate()
is used to animate css properties of elements.top:"-900px"
here your element should be animate back to top.25000
is the time to take to perform animation.topSet
is a callback function which is getting called when animation ends.Upvotes: 3
Reputation: 1922
jQuery selects the appropriate DOM element, in this case the element with class
'topRise':
$(."topRise")
Calls the jQuery animate()
function, supplying some CSS properties to be set:
{top: "-900px"}
the duration of the animation, in milliseconds:
25000
the callback function which is called on completion
topSet
putting it all together:
function topRise() {
$(".topRise").animate({
top: "-900px"
}, 25000, topSet);
};
More information on jQuery animate and jQuery selectors
Upvotes: 4
Reputation: 1474
it will set css property top to -900px for tags those having class .topRise by running animation for 25000 millisecond then it will call topSet which is a callback function
Please look here for more info : http://api.jquery.com/animate/
Upvotes: 2
Reputation: 29683
When you call topRise()
anywhere in js
it will animate
/move
the element/s with class named topRise
and the movement will happen to -900px
to top
and this will happen within a span of 25000 milliseconds i.e. 25 seconds. the callback topSet
is a function that gets executed once 25 seconds of animation gets completed
Upvotes: 8
Reputation: 93571
function topRise() {
$(".topRise").animate({
top: "-900px"
}, 25000, topSet);
};
It animates the top
property of any elements with class="topRise"
to a value of "-900px" over 25000 milliseconds (25 seconds) i.e. it moves them up, then it calls another function called topSet when complete.
Upvotes: 5