Skip to content

Commit b1a9658

Browse files
agcolomapsdehal
authored andcommitted
Popup: Fixed scaling image example
Closes gh-338
1 parent 1c0cbe4 commit b1a9658

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

entries/popup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<p>The handler is bound to the <code>popupbeforeposition</code> event, which ensures the image is not only scaled before it is shown but also when the window is resized (e.g. orientation change). In this code example the height is reduced by 60 to take a top and bottom tolerance of 30 pixels into account.</p>
3838

3939
<pre><code><![CDATA[
40-
$( document ).on( "pageinit", function() {
40+
$( document ).on( "pagecreate", function() {
4141
$( ".photopopup" ).on({
4242
popupbeforeposition: function() {
4343
var maxHeight = $( window ).height() - 60 + "px";

resources/popup/example3.html

+10
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,15 @@
3737
</div>
3838
</div>
3939
</div>
40+
<script>
41+
$( document ).on( "pagecreate", function() {
42+
$( ".photopopup" ).on({
43+
popupbeforeposition: function() {
44+
var maxHeight = $( window ).height() - 60 + "px";
45+
$( ".photopopup img" ).css( "max-height", maxHeight );
46+
}
47+
});
48+
});
49+
</script>
4050
</body>
4151
</html>

0 commit comments

Comments
 (0)