2012-12-04 33 views
1

因此,我正在与Jquery Mobile和photoswipe一起为一个投资组合创建一个小型图库,但是一旦我发出了photoswipe的调用,它就会立即在浏览器中打开图库。它不是来自photoswipe网站的默认电话,因为它不起作用。jquery mobile中的Photoswipe开放式图库

继承人我的代码。

<!DOCTYPE html> 
<html> 
<head> 

    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" /> 
    <meta name="apple-mobile-web-app-capable" content="yes" /> 


    <link rel="stylesheet" type="text/css" href="jquery-mobile/jquery.mobile.structure.css"> 
    <link rel="stylesheet" type="text/css" href="jquery-mobile/jquery.mobile.css"> 
    <link rel="stylesheet" type="text/css" href="jquery-mobile/jquery.mobile.theme.css"> 
    <link rel="stylesheet" type="text/css" href="jquery-mobile/photoswipe.css"> 



    <script type-"text/javascript" src="jquery-mobile/jquery.js"></script> 
    <script type-"text/javascript" src="jquery-mobile/jquery.mobile.js"></script> 
    <script type="text/javascript" src="jquery-mobile/klass.min.js"></script> 
    <script type="text/javascript" src="jquery-mobile/code.photoswipe.jquery-3.0.5.js"></script> 

    <script type="text/javascript"> 

     (function(window, $, PhotoSwipe) 
     { 
      $(document).ready(function() 
      { 
       $("#gallery a").photoSwipe(
       { 
        enableMouseWheel: false, 
        enableKeyboard: false 
       }); 

       $("#gallery a:first").click(); 
      }); 
     }(window, window.jQuery, window.Code.PhotoSwipe)); 

    </script> 

</head> 
<body> 

<div data-role="page"> 

    <div data-role="header"> 
    <h1>welcome</h1> 
    </div> 

    <div id="gallery"> 


      <a href="web/full/photo1.jpg" rel="external"><img src="web/thumb/photo1thumb.jpg" alt="Image 001" /></a> 
      <a href="web/full/photo2.jpg" rel="external"><img src="web/thumb/photo2thumb.jpg" alt="Image 002" /></a> 
      <a href="web/full/photo3.jpg" rel="external"><img src="web/thumb/photo3thumb.jpg" alt="Image 003" /></a> 
      <a href="web/full/photo4.jpg" rel="external"><img src="web/thumb/photo4thumb.jpg" alt="Image 004" /></a> 
      <a href="web/full/photo5.jpg" rel="external"><img src="web/thumb/photo5thumb.jpg" alt="Image 005" /></a> 
      <a href="web/full/photo6.jpg" rel="external"><img src="web/thumb/photo6thumb.jpg" alt="Image 006" /></a> 


    </div> 

    <div data-role="footer"> 
    <h2>2012</h2> 
    </div> 
</div> 

</body> 
</html> 

任何想法我应该做什么?

回答

0

尝试删除

$("#gallery a:first").click(); 

我想你调用init进程$("#gallery a").photoSwipe

+0

大后,这是调用库,一切正常。我只是不确定为什么默认调用不起作用?这里的呼叫 $(文件)。就绪(函数(){ \t VAR myPhotoSwipe = $( “#画廊”)photoSwipe({enableMouseWheel:假的,enableKeyboard:假}); – mhartington