jquery mobile - How to check if jQM popup fits user's viewport? -


so i've managed add scrollbars large jqm popups css('overflow-y', 'scroll'). how only when popup larger user's viewport?

i'm trying jquery-visible plugin can't respond:

http://jsfiddle.net/mmrnq/124/

$('#test-button').on('click', function(e) {        $('#confirmdialog').popup('open');    // https://stackoverflow.com/questions/20791374/jquery-check-if-element-is-visible-in-viewport      if(!$('#confirmdialog').visible(true)) {     alert('popup not visible - add overflow scrolling');     $('#confirmdialog').css('overflow-y', 'scroll');    }   }); 

you can use

overflow-y: auto 

this makes scrollbar visible when needed.

updated fiddle

update:

you can make content of popup scrollable titlebar remains in view:

#confirmdialog .ui-content {     overflow-y: auto; }  $('#confirmdialog').on({   popupbeforeposition: function() {       var maxheight = $(window).height() - 120;       $('#confirmdialog .ui-content').height(maxheight);   } }); 

demo


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -