This seems pretty simple, but I can\’t figure it out. I\’m new to javascript/ jquery.
i want to trigger a function to move a div onmouseover, and another onmouseout. I want to call this same function on several different divs. how would I do this without writing multiple functions?
<div id=\"indexJoinBanner\" onmouseover=\"moveDivRight()\" onmouseout=\"moveDivLeft()\">
<!-- end #indexJoinBanner --></div>
<div id=\"indexJoinBanner2\" onmouseover=\"moveDivRight()\" onmouseout=\"moveDivLeft()\">
<!-- end #indexJoinBanner2 --></div>
function moveDivRight(){
$(\"#indexJoinBanner\").animate({
left: \"0px\",
},500 );
};
function moveDivLeft() {
$(\"#indexJoinBanner\").animate({
left: \"-150px\",
},500 );
}
Thanks





Rating:
The post javascript – using the same function of different events appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-using-the-same-function-of-different-events.html
No comments:
Post a Comment