javascript - How to get the height and width of window in bootstrap -


in bootstrap have fixed top nav bar , fixed bottom nav bar. want show large image in background between space of 2 nav bars , want cover width of window. how can dynamically height between navbars , width of window? window size may change depending on device.so need dynamic

$(window).resize(function() {     var top_nav_height = $("#id_of_top_nav").height();     var bottom_nav_height = $("#id_of_bottom_nav").height();       var window_height = $(window).height();      var height_of_open_space = window_height - (top_nav_height+bottom_nav_height);      $("#id_of_img").css({          height:height_of_open_space+'px';     });  }); 

this fine if 0px padding , margin, if not values , subtract height_of_open_space before applying img height


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -