Upgrade jQuery 1.4.4 to 1.8.3 -
i have "paralax effect" script uses jquery 1.4.4. need upgrade 1.8.3 version.
i have .bind()
thats not working 1.8.3.
see script:
$(document).ready(function() { //when document ready... //save selectors variables increase performance var $window = $(window); var $firstbg = $('#home'); var $secondbg = $('#produtos'); var $thirdbg = $('#empresa'); var $fourthbg = $('#contato'); var trainers = $("#second .bg"); var windowheight = $window.height(); //get height of window //apply class "inview" section in viewport $('#home, #produtos, #empresa, #contato').bind('inview', function (event, visible) { if (visible == true) { $(this).addclass("inview"); } else { $(this).removeclass("inview"); } }); //function places navigation in center of window function repositionnav(){ var windowheight = $window.height(); //get height of window var navheight = $('#nav').height() / 2; var windowcenter = (windowheight / 2); var newtop = windowcenter - navheight; $('#nav').css({"top": newtop}); //set new top position of navigation list } //function called every pixel user scrolls. determines position of background /*arguments: x = horizontal position of background windowheight = height of viewport pos = position of scrollbar adjuster = adjust position of background inertia = how fast background moves in relation scrolling */ function newpos(x, windowheight, pos, adjuster, inertia){ return x + "% " + (-((windowheight + pos) - adjuster) * inertia) ; } //function called whenever window scrolled or resized function move(){ var pos = $window.scrolltop(); //position of scrollbar //if first section in view... if($firstbg.hasclass("inview")){ //call newpos function , change background position $firstbg.css({'backgroundposition': newpos(50, windowheight, pos, 900, 0.3)}); } //if second section in view... if($secondbg.hasclass("inview")){ //call newpos function , change background position $secondbg.css({'backgroundposition': newpos(50, windowheight, pos, 1250, 0.3)}); //call newpos function , change secnond background position trainers.css({'backgroundposition': newpos(50, windowheight, pos, 1900, 0.6)}); } //if third section in view... if($thirdbg.hasclass("inview")){ //call newpos function , change background position $thirdbg.css({'backgroundposition': newpos(50, windowheight, pos, 2850, 0.3)}); } //if fourth section in view... if($fourthbg.hasclass("inview")){ //call newpos function , change background position css3 multiple backgrounds $fourthbg.css({'backgroundposition': newpos(0, windowheight, pos, 200, 0.9) + ", " + newpos(50, windowheight, pos, 0, 0.7) + ", " + newpos(50, windowheight, pos, 0, 0.5) + ", " + newpos(50, windowheight, pos, 700, 0.3)}); } $('#pixels').html(pos); //display number of pixels scrolled @ bottom of page } repositionnav(); //reposition navigation center in window when script loads $window.resize(function(){ //if user resizes window... move(); //move background images in relation movement of scrollbar repositionnav(); //reposition navigation list remains vertically central }); $window.bind('scroll', function(){ //when user scrolling... move(); //move background images in relation movement of scrollbar }); });
i have try put .on()
, .click()
don't work.
what need change?
Comments
Post a Comment