javascript - jquery window orientation change event not working in requirejs -
i have 1 problem when use window orientation change event not firing on devices. here, have added code. please me out issue.
example code,
define(["jquery"], function($) { $(function() { set_screen(); }); function set_screen(){ var winh = $(window).height(), winw = $(window).width(); $('.fullscreen-slider ul.slide li').css({'height':winh}); } $(window).on("orientationchange", function(event) { set_screen(); }); });
this may explain why not getting window height expect, though need see html , css sure:
jquery $(window).height() returning document height
that said, @lshetty pointed out in comments above, can achieve same result more giving element height of 100%. best in stylesheet file, if have in javascript:
define(["jquery"], function($) { $(function() { $('.fullscreen-slider ul.slide li').css({'height':'100%'}); }); }); no orientationchange handler needed.
Comments
Post a Comment