Jquery图像滑块不能正常工作

时间:2017-10-30 10:22:15

标签: javascript jquery slider

您好我使用此插件:https://github.com/elclanrs/jq-tiles 用于在我的网站标题中创建图像滑块。我使用的是Asp.net MVC。 不幸的是,滑块不会像演示一样工作。它不是显示一行和一列,而是显示2列和x行的滑块(x是我在滑块中使用的图像数。

这是我的索引cshtml代码:

 @{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="~/Content/jquery.tiles.min.css" rel="stylesheet" />

<script 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>

<script src="~/Scripts/jquery.tiles.js"></script>

<div class="slider">
    <img src="~/Content/img/img01.jpg" /> <!-- No description -->
    <img src="~/Content/img/img02.jpg" /> <!-- No description -->
    <img src="~/Content/img/img03.jpg" /> <!-- No description -->
    <img src="~/Content/img/img04.jpg" /> <!-- No description -->
    <img src="~/Content/img/img05.jpg" /> <!-- No description -->
    <img src="~/Content/img/img06.jpg" /> <!-- No description -->
    <img src="~/Content/img/img07.jpg" /> <!-- No description -->
    <img src="~/Content/img/img08.jpg" /> <!-- No description -->
    <img src="~/Content/img/img09.jpg" /> <!-- No description -->
    <img src="~/Content/img/img10.jpg" /> <!-- No description -->
</div>


<script>

    $('.slider').tilesSlider({
        x: 15, // # of tiles in x axis, 20 max
        y: 10, // # of tiles in y axis, 20 max
        effect: 'simple',
        fade: false, // fade images in addition to the tiles effect
        random: true, // animate tiles in random order
        reverse: false, // start animation from opposite direction
        backReverse: false, // reverse the animation when going back in the slideshow (useful for some effects)
        rewind: false, // reverse animation at a certain percentage in time
        auto: true, // Start the slideshow on load
        loop: true, // Start slideshow again when it finishes
        slideSpeed: 3500, // time between slides
        tileSpeed: 800, // time to clear all tiles
        cssSpeed: 300, // css3 transition speed [100,200,300,400,500,600,700,800,900,1000],
        nav: false, // Add navigation
        navWrap: null, // Add the navigation to an existing element
        bullets: false, // Show bullets, if false the show pagination with numbers
        thumbs: false, // Show thumbnails when hovering nav
        thumbSize: 25, // Thumbnail size (percentage of the original image)
        timer: false // show or hide the timer bar

    });



</script>

动画和过渡效果很好,唯一的问题就是重复图像,如图所示:pic1

1 个答案:

答案 0 :(得分:0)

尝试将轮播项目包装样式设置为background-repeat: no-repeat