仅将滑动添加到一个插件J.Query 1.6.1



概述:

我在网站上使用了两个J.Query插件。我需要向其中一个添加左右滑动作为功能。我在下面使用J.Query Mobile最新版本成功完成了此操作:

   <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
   <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-
   1.4.5.min.js"></script>

全部仅在其他插件之外的孤立代码中正常工作。

问题:

不幸的是,另一个插件仅适用于高于J.Query-1.6.1的任何J.Query版本,当我包含上面提到的更高版本时,其他插件停止正常工作。

我找不到与1.6.1兼容的J.Query移动设备,因此两个插件可以在同一版本上使用。是否可以使用兼容的J.Query移动版本,以便我可以添加像这样的刷卡:

   function swiping(){
  $(function(){
  var anim = $('div#carousel');
  $(anim).on( "swipeleft", swiper );
  $(anim).on( "swiperight", swiper1 );
  function swiper(e){
    e.stopPropagation();
    e.preventDefault();
    $('div#carousel').roundabout('animateToNextChild', showCaption);
    }
   function swiper1(e){
    e.stopPropagation();
    e.preventDefault();
    $('div#carousel').roundabout('animateToPreviousChild', showCaption);
    }
    });
    }

如果没有,如何将两个插件可以在相同的J.Query 1.6.1上运行的方式添加滑动(左写和写)。两者确实运行良好,但没有滑动,我只需要添加到其中一个。

为了将所有内容保持在同一版本的J.Query中,并将移动的Swipe添加到一个插件中,我必须更改写作功能的方式,我遵循下面的示例Plus Plus Plus添加了J.Query Mobile的旧版本:

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.6.1.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css">
<script type='text/javascript'
  src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
<style type='text/css'>
.add-border {
  border-style: solid;
  border-width: 1px;
  width: 100%;
  text-align: center;
}
</style>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
function bindEvent(element) {
    element.bind('tap taphold swipe swiperight swipeleft', function(event, ui) {
       alert('Event: '+event.type); 
    });
}
bindEvent($('#display-event'));
});//]]>  
</script>
</head>
<body>
  <div data-role="page" id="home">
    <div data-role="content">
      <div id="display-event" class="add-border">
        <p>Tap, TapHold (for 1 second), Swipe, SwipeRight or SwipeLeft</p>
      </div>
    </div>
  </div>
</body>
</html>

最新更新