Response title
This is preview!
popupbeforeposition
event isn't being fired, or isn't being fired at the correct time./* Options Menu */
$("#OptionsMenuPanel").on({
popupbeforeposition: function () {
var h = $(window).height();
$("#OptionsMenuPanel").css("height", h);
}
});
<!DOCTYPE html> <html> <head> <title>Page 1</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-rc.1/jquery.mobile-1.2.0-rc.1.min.css" /> <script src="http://code.jquery.com/jquery-1.8.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.2.0-rc.1/jquery.mobile-1.2.0-rc.1.min.js"></script> <style> /* Options Menu */ #OptionsMenuPanel { width: 200px; border: 1px solid #000; border-right: none; background: rgba(0,0,0,.5); margin: -1px 0; } #OptionsMenuPanel-popup { right: 0 ! important; left: auto ! important; } #OptionsMenuPanel .ui-btn { margin: 12px 15px; } </style> </head> <body> <div data-role="page"> <div data-role="header"> <h1>Page 1</h1> <a href="#OptionsMenuPanel" data-rel="popup" data-transition="slide" data-position-to="window" data-icon="grid" class="ui-btn-right">Menu</a> </div><!-- /header --> <div data-role="content"> <h2>Page 1</h2> <p><a href="page2.htm" data-role="button">Page 2</a></p> </div><!-- /content --> <!-- Hidden Options Menu Panel. --> <div data-role="popup" id="OptionsMenuPanel" data-corners="false" data-theme="none" data-shadow="false" data-tolerance="0,0"> <a href="#" data-role="button" data-icon="home" data-theme="a" title="Homepage">Home</a> <a href="#" data-role="button" data-icon="plus" data-theme="a" title="Make a new booking">Booking</a> <a href="#" data-role="button" data-icon="info" data-theme="a" title="Information">Information</a> <a href="#" data-role="button" data-icon="gear" data-theme="a" title="Change your password">Password</a> <a href="#" data-role="button" data-icon="gear" data-theme="a" title="Change your profile picture">Profile Pic</a> <a href="#" data-role="button" data-icon="gear" data-theme="a" title="Send some feedback">Feedback</a> <a href="#" data-role="button" data-icon="star" data-theme="a" title="Desktop Site" rel="external">Desktop Site</a> <a href="#" data-role="button" data-icon="back" data-theme="a" title="Logout">Logout</a> </div> <script type="text/javascript"> /* Options Menu */ $("#OptionsMenuPanel").on({ popupbeforeposition: function () { var h = $(window).height(); $("#OptionsMenuPanel").css("height", h); } }); </script> </div><!-- /page --> </body> </html>
<!DOCTYPE html> <html> <head> <title>Page 2</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-rc.1/jquery.mobile-1.2.0-rc.1.min.css" /> <script src="http://code.jquery.com/jquery-1.8.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.2.0-rc.1/jquery.mobile-1.2.0-rc.1.min.js"></script> <style> /* Options Menu */ #OptionsMenuPanel { width: 200px; border: 1px solid #000; border-right: none; background: rgba(0,0,0,.5); margin: -1px 0; } #OptionsMenuPanel-popup { right: 0 ! important; left: auto ! important; } #OptionsMenuPanel .ui-btn { margin: 12px 15px; } </style> </head> <body> <div data-role="page"> <div data-role="header"> <h1>Page 2</h1> <a href="#OptionsMenuPanel" data-rel="popup" data-transition="slide" data-position-to="window" data-icon="grid" class="ui-btn-right">Menu</a> </div><!-- /header --> <div data-role="content"> <h2>Page 2</h2> <p><a href="page1.htm" data-role="button">Page 1</a></p> </div><!-- /content --> <!-- Hidden Options Menu Panel. --> <div data-role="popup" id="OptionsMenuPanel" data-corners="false" data-theme="none" data-shadow="false" data-tolerance="0,0"> <a href="#" data-role="button" data-icon="home" data-theme="a" title="Homepage">Home</a> <a href="#" data-role="button" data-icon="plus" data-theme="a" title="Make a new booking">Booking</a> <a href="#" data-role="button" data-icon="info" data-theme="a" title="Information">Information</a> <a href="#" data-role="button" data-icon="gear" data-theme="a" title="Change your password">Password</a> <a href="#" data-role="button" data-icon="gear" data-theme="a" title="Change your profile picture">Profile Pic</a> <a href="#" data-role="button" data-icon="gear" data-theme="a" title="Send some feedback">Feedback</a> <a href="#" data-role="button" data-icon="star" data-theme="a" title="Desktop Site" rel="external">Desktop Site</a> <a href="#" data-role="button" data-icon="back" data-theme="a" title="Logout">Logout</a> </div> <script type="text/javascript"> /* Options Menu */ $("#OptionsMenuPanel").on({ popupbeforeposition: function () { var h = $(window).height(); $("#OptionsMenuPanel").css("height", h); } }); </script> </div><!-- /page --> </body> </html>
Into my link and my popup :
<div data-role="popup" id="popupDialog1<?php echo "$page" ?> " data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width:400px;">
And I added the var into my include :
© 2013 jQuery Foundation
Sponsored by and others.