Am using a bit of javascript to animate an a class within a div class.
$(".previouscontainer").mouseenter(function(){
$("a.previousarrow").animate({left:'0px'},"fast");
});
$(".previouscontainer").mouseleave(function(){
$("a.previousarrow").animate({left:'10px'},"fast");
});
$(".nextcontainer").mouseenter(function(){
$("a.nextarrow").animate({right:'0px'},"fast");
});
$(".nextcontainer").mouseleave(function(){
$("a.nextarrow").animate({right:'10px'},"fast");
});
Was wondering whether there is a better/cleaner way to write this?
You can chain them.
or use hover which takes both functions
Or you can go mad and create your own event
if you need to bind it to various actions that can’t be in the same selector
There are other ways to swing this cat.
.hover()is the most sensible.