What is the error?
What is the error?
Hi.. could anyone tell me why this is doesn't work? the problem is when I open the page that at the beginning the .flex-viewport is not in the right place as when I resize or I reload the page... I premise that I'm not good with jquery and I'm trying to learn!
-
- var halfWindowHeight = jQuery( window ).height()/2;
- var halfViewportHeight = jQuery('#content .flexslider .slides li').height()/2;
-
- function putOnTheMiddle(){
- var halfWindowHeight = jQuery( window ).height()/2;
- var halfViewportHeight = jQuery('#content .flexslider .slides li').height()/2;
- var result = parseFloat(halfWindowHeight) - parseFloat(halfViewportHeight);
- var viewportNavHeight = jQuery('.flex-control-nav li').height();
- var paddingViewNav = jQuery('.flex-control-nav').css('padding-top');
- var totViewNav = parseFloat(viewportNavHeight) + parseFloat(paddingViewNav);
-
- jQuery('.flex-viewport').css("margin-top", result - parseFloat(totViewNav) + "px");
- }
-
-
- jQuery( window ).load(function(halfViewportHeight){
- putOnTheMiddle()
- });
-
- jQuery( window ).resize(function(halfViewportHeight){
- putOnTheMiddle()
- });