javascript - Transform not working in firefox with jQuery scroll effect -


i having problems getting scroll effect work in firefox, have working fine in chrome, safari , opera code, can't see wrong '-moz-transform' line of code.

i have checked in firefox browser , shows following

element {     transform: rotate(0deg); } 

the rotate value remains @ zero, new jquery , not sure how debug here. please see code below:

$(window).scroll(function(){       var $cog = $('#my-div'),         $body = $(document.body),         bodyheight = $body.height();      $cog.css({         'transform': 'rotate(' + ($body.scrolltop() / bodyheight * -360) + 'deg)',         '-moz-transform': 'rotate(' + ($body.scrolltop() / bodyheight * -360) + 'deg)',         '-webkit-transform': 'rotate(' + ($body.scrolltop() / bodyheight * -360) + 'deg)',         '-o-transform': 'rotate(' + ($body.scrolltop() / bodyheight * -360) + 'deg)'     });  }); 

please use , let me know in case of issue.

$(window).on('scroll', function() {      var cog = $('div'),      body = $(document),      bodyheight = body.height();      cog.css({      'transform': 'rotate(' + (body.scrolltop() / bodyheight * -360) + 'deg)',      '-o-transform': 'rotate(' + (body.scrolltop() / bodyheight * -360) + 'deg)',      '-moz-transform': 'rotate(' + (body.scrolltop() / bodyheight * -360) + 'deg)',      '-webkit-transform': 'rotate(' + (body.scrolltop() / bodyheight * -360) + 'deg)',    });    });
body {    min-height: 900px;  }  div {    transform: rotate(0deg);  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div>    rotate  </div>

the usual reason document.body null because you're executing script before tag(*) has been encountered. without seeing code can't sure, that'd usual reason. move you've put scripts.

please visit question detailed information.

why document.body == null in firefox not safari


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

android - CoordinatorLayout, FAB and container layout conflict -