jQuery Mobile - 缩放图像
描述
您可以缩放横向和纵向格式的图像。
示例
以下示例演示了在 jQuery Mobile 框架中缩放图像的使用。
<!DOCTYPE html> <head> <title>Scaling Images</title> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> <script src = "http://demos.jquerymobile.com/1.4.5/popup-image-scaling/popup-image-scaling.js"></script> </head> <body> <div data-role = "header"> <h2>Header</h2> </div> <a href = "#popup_landscape" data-rel = "popup" data-position-to = "window" class = "ui-btn ui-btn-inline">Landscape View</a> <a href = "#popup_portrait" data-rel = "popup" data-position-to = "window" class = "ui-btn ui-btn-inline" data-transition = "fade">Portrait View</a> <div data-role = "popup" id = "popup_landscape" class = "photopopup" data-overlay-theme = "a" data-tolerance = "30,15"> <a href = "#" data-rel = "back" class = "ui-btn ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a> <img src = "/jquery_mobile/images/blue_hills1.jpg" alt = "Landscape View"> </div> <div data-role = "popup" id = "popup_portrait" class = "photopopup" data-overlay-theme = "a" data-tolerance = "30,15"> <a href = "#" data-rel = "back" class = "ui-btn ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a> <img src = "/jquery_mobile/images/blue_hills2.jpg" alt = "Portrait View"> </div> <div data-role = "footer"> <h2>Footer</h2> </div> </body> </html>
输出
让我们执行以下步骤,看看上面的代码是如何工作的 −
将上述 html 代码保存为服务器根文件夹中的 jqm_scaling_images.html 文件。
将此 HTML 文件打开为 http://localhost/jqm_scaling_images.html,将显示以下输出。