almost 11 years ago
Hello Readers !
Here is an example of parallax with simple script and it is also compatible with internet explorer.
- <script type="text/javascript">
- $(document).ready(function() {
- $(window).bind('scroll',function(){
- parallax();
- })
- })
- function parallax(){
- var scrollposition=$(window).scrollTop();
- $('.ground').css('top',(0 - (scrollposition * .1))+'px')
- $('.box').css('top',(0 + (scrollposition * 1.2))+'px')
- }
- </script>
<script type="text/javascript"> $(document).ready(function() { $(window).bind('scroll',function(){ parallax(); }) }) function parallax(){ var scrollposition=$(window).scrollTop(); $('.ground').css('top',(0 - (scrollposition * .1))+'px') $('.box').css('top',(0 + (scrollposition * 1.2))+'px') } </script>
0 Comment(s)