Saturday, 15 September 2012

javascript - jQuery animate marginRight not working, but marginLeft works just fine -



javascript - jQuery animate marginRight not working, but marginLeft works just fine -

hey guys trying create background image scroll left using animate marginright property activated clicking link, not working. weird thing when utilize marginleft works, backwards. here test site, , here non working jquery code: (again im trying background image scroll left) please allow me know if can post else create easier on you.

<script type="text/javascript"> jquery(document).ready( function(){ jquery('#homelink').click( function(){ jquery('#sitebackground').animate({ marginright : "1000px" },10000); }); }); </script>

and html: (#sitebackground want move left, , #homelink activator)

<img id="sitebackground" src="/jscottsavage/media/main/backdrop.jpg" style="position: absolute; left: 0px; top: 0px; z-index: -1; height: 384px;"> <div id="homelink">home</div>

alright guys figured out way this. i'm not sure if right/proper way works in firefox, chrome, , ie 7+ i'm going utilize until find improve way it. alter 'marginright' 'marginleft', , add together - sign in front end of number, seen below.

<script type="text/javascript"> jquery(document).ready( function(){ jquery('#homelink').click( function(){ jquery('#sitebackground').animate({ marginleft : "-1000px" },10000); }); }); </script>

javascript jquery html css

No comments:

Post a Comment