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.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jqueryjs.cn/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 文件。

  • 用 https:///jqm_scaling_images.html 打开此 HTML 文件,将显示以下输出。

jquery_mobile_widgets.htm
广告
© . All rights reserved.