有人可以帮我找到错误使滑块不滑动?

时间:2016-06-01 23:16:52

标签: jquery hammer.js

这是www.croquetero.com上滑块的代码 滑块不会突然滑动。它正在使用此代码,现在它不是。我真的很感谢有人帮助我查明问题

{{ 'nivodefault.css' | asset_url | stylesheet_tag }}
{{ 'nivo-slider.css' | asset_url | stylesheet_tag }}



<div id="wrapper">
<div class="slider-wrapper theme-default">
  <div id="slider" class="nivoSlider">
    <a href="http://croquetero.com/pages/hot-sale"><img src="//cdn.shopify.com/s/files/1/0740/0383/files/Banner-Hot-sale-web_1024x1024.png?12813352639418963988" alt="hot sale" /></a>
        <a href="http://croquetero.com/pages/programa-y-ahorra?utm_source=homepage&utm_medium=banner&utm_campaign=bannerprogramayahorra280116"><img src="//cdn.shopify.com/s/files/1/0740/0383/files/programayahorrahome_1.png?10630346986431682724" alt="Vive la experiencia Programa y Ahorra"/></a>
</div>
</div>
</div>

{{ 'hammer.min.js' | asset_url | script_tag }}
{{ 'jquery.nivo.slider.js'| asset_url | script_tag }}
 <script type="text/javascript">

 jQuery(document).ready(function($) {  
  if ("ontouchstart" in document.documentElement) {
    $('#slider').nivoSlider({
        effect: 'slideInLeft',
        animSpeed: 100,
        pauseTime: 10
    });


 $('a.nivo-nextNav').css('visibility', 'hidden');
    $('a.nivo-prevNav').css('visibility', 'hidden');

        var element = document.getElementById('slider');

        var hammertime = Hammer(element).on("swipeleft", function(event) {
            $('#slider img').attr("data-transition","slideInLeft");
            $('a.nivo-nextNav').trigger('click');
            return false; 

        });

        var hammertime = Hammer(element).on("swiperight", function(event) {
            $('#slider img').attr("data-transition","slideInRight");
            $('a.nivo-prevNav').trigger('click');
            $('#slider img').attr("data-transition","slideInLeft");
            return false;

        });

}

else {

    $('#slider').nivoSlider({
        effect: 'fade',
        animSpeed: 700,
        pauseTime: 10,
    });

}

});



</script> 

0 个答案:

没有答案