wordpress - Divs not resizing with jQuery resize() -


i'm working jquery , foundation framework. it's built wordpress theme, that's why have use "jquery" instead of short hand $ denotation.

jquery resizes slides upon loading page. won't resize if resize browser window. i've tried lots of stuff can't work. (border-box, separate functions, different syntax).

jquery( document ).ready(function($) {     var width = jquery(window).width(),         height = jquery(window).height() - jquery('.top-bar').height();     jquery('.slide').height(height).width(width);     jquery('.slide4 > div > img').height(height*.5);      jquery(window).resize(function() {         jquery('.slide').height(height).width(width);         jquery('.slide4 > div > img').height(height*.5);     }); }); 

you can put code inside of resize event , trigger @ page load. can use $ in code using iif. should try throttle resizing, cool now!

// can use $ inside here... (function($){    // when document ready called...   $(function(){      // we'll using thise more once!     var $window = $(window);      // whenever resize event occurs, this...     $window.on('resize', function(e){        var width = $window.width(),            height = $window.height() - $('.top-bar').height();        $('.slide').height(height).width(width);       $('.slide4 > div > img').height(height*.5);      // "trigger" fakes event on load...     }).trigger('resize');     })  })(jquery); // you're passing jquery iif, why can use $ inside. 

hopefully helps!


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -