簡體   English   中英

如何在中預覽移動網站 <iframe> 在引導模式下站點的桌面版本中

[英]How to preview mobile site in <iframe> in desktop version of site in bootstrap modal

我想在桌面版本中顯示網站的移動版本。 基本上我們有2個網站m.xyz.com和xyz.com,現在我想要的是在單擊預覽時在桌面上顯示m.xyz.com。

<script>
$('#preview_feature').click(function() {

            $('.faqModal').on('shown.bs.modal',function(){     

              $(this).find('iframe').attr('src','https://m.xyz.com/abc')
            })
              $('.faqModal').modal({show:true})
            })
    </script>

    //On click of this button i am showing model which will preview mobile version of website 
    <button type="button" id="preview_feature" class="btn btn-info btn-lg btn"  >Preview Feature</button>

    <!-- Modal -->
      <div class="modal fade faqModal" id="faqModal" role="dialog">
        <div class="modal-dialog">
          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title">Preview</h4>
            </div>
            <div class="modal-body">
              <iframe style="width:940px;height:560px;-webkit-transform:scale(1);-moz-transform-scale(1);"></iframe>
              </iframe>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
          </div>  
        </div>
      </div>

看到這對我有用:

<!DOCTYPE html>
<html>
    <body>
        <iframe src="https://en.m.wikipedia.org/wiki/Main_Page" width="400px" height="500px">
        </iframe>
    </body>
</html>

請嘗試減小寬度,以便如果它使用正確的js進行移動平台重定向,那么它將正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM