tengo est script
Código HTML:
Config = { windowWidth: 0, windowHeigth: 0, pixRatio: 1, setWindowVars: function(){ Config.windowWidth = $(window).width(); Config.windowHeight = $(window).height(); //alert("el Config.windowHeight es " + Config.windowHeight); try { Config.pixRatio = window.devicePixelRatio ; } catch(err) { Config.pixRatio = 1; }; } }; Ellugar = { el: null, init: function(){ Ellugar.el = $('#ellugar'); Ellugar.setSize(); $(window).resize(function() { Ellugar.setSize(); }); }, setSize: function(){ $actualH = Ellugar.el.height(); $actualO = Ellugar.el.outerHeight(); $size = Config.windowHeight-$actualO; if($size > 0){ Ellugar.el.height($actualH+$size); } } } NuestroComplejo = { el: null, init: function(){ NuestroComplejo.el = $('#nuestrocomplejo'); NuestroComplejo.setSize(); $(window).resize(function() { NuestroComplejo.setSize(); }); }, setSize: function(){ $actualH = NuestroComplejo.el.height(); $actualO = NuestroComplejo.el.outerHeight(); $size = Config.windowHeight-$actualO; if($size > 0){ NuestroComplejo.el.height($actualH+$size); } } } ClubHouse = { el: null, init: function(){ ClubHouse.el = $('#clubhouse'); ClubHouse.setSize(); $(window).resize(function() { ClubHouse.setSize(); }); }, setSize: function(){ $actualH = ClubHouse.el.height(); $actualO = ClubHouse.el.outerHeight(); $size = Config.windowHeight-$actualO; if($size > 0){ ClubHouse.el.height($actualH+$size); } } } Servicios = { el: null, init: function(){ Servicios.el = $('#servicios'); Servicios.setSize(); $(window).resize(function() { Servicios.setSize(); }); }, setSize: function(){ $actualH = Servicios.el.height(); $actualO = Servicios.el.outerHeight(); $size = Config.windowHeight-$actualO; if($size > 0){ Servicios.el.height($actualH+$size); } } } Fotos= { el: null, init: function(){ Fotos.el = $('#fotos'); Fotos.setSize(); $(window).resize(function() { Fotos.setSize(); }); }, setSize: function(){ $actualH = Fotos.el.height(); $actualO = Fotos.el.outerHeight(); $size = Config.windowHeight-$actualO; if($size > 0){ Fotos.el.height($actualH+$size); } } } Layout = { windowWidth: 0, windowHeigth: 0, pixRatio: 1, desktopInnerMenuHeight: 0, desktopMenuPaddingSize: 0, headerHeight: 0, lastSection: '/', init: true, state: window.history.pushState !== undefined, setup: function() { Config.setWindowVars(); Layout.setAddress(); Home.init(); Ellugar.init(); NuestroComplejo.init(); ClubHouse.init(); Servicios.init(); Fotos.init(); $(window).resize(function() { Config.setWindowVars(); }); $(window).bind('scroll',function(){ Layout.setNav(); }); }, setMenuHeight: function(){ }, // seteo el nav setNav: function(){ $ellugar = $('#ellugar'); $nuestrocomplejo = $('#nuestrocomplejo'); $clubhouse = $('#clubhouse'); $servicios = $('#servicios'); $fotos = $('#fotos'); $ubicacion = $('#ubicacion'); $contacto = $('#contacto'); $reservas = $('#reservas') var $view = $(window); var $nav = $('nav'); var ellugarOffset = $ellugar.offset().top - $ellugar.outerHeight() * 0.3; // var portfolioOffset = $('#portfolio').offset().top - $('#portfolio').outerHeight() * 0.3; // var aboutOffset = $('#team').offset().top - $('#team').outerHeight() * 0.3; // var contactOffset = $('#contact').offset().top - $('#contact').outerHeight() * 0.3; var viewScrollTop = $view.scrollTop(); if (viewScrollTop > $ellugar.offset().top && viewScrollTop < $nuestrocomplejo.offset().top-100) { $('.nav-link.on').removeClass('on'); $('.nav-work').addClass('on'); } else if(viewScrollTop > $nuestrocomplejo.offset().top-100 && viewScrollTop < $clubhouse.offset().top-100) { $('.nav-link.on').removeClass('on'); $('.nav-cuko').addClass('on'); } else if(viewScrollTop > $team.offset().top-30 && viewScrollTop < $contact.offset().top-100) { $('.nav-link.on').removeClass('on'); $('.nav-team').addClass('on'); } else if(viewScrollTop > $contact.offset().top-100) { $('.nav-link.on').removeClass('on'); $('.nav-contact').addClass('on'); } }, setAddress: function($content){ if (Layout.state && Layout.init) { Layout.init = false; } else { } } } var History, HistoryRootURL; $(function() { History = window.History, HistoryRootURL = History.getRootUrl(); Layout.setup(); });
uso una we