【问题标题】:How to remove pagination from slider in jquery?如何从 jquery 中的滑块中删除分页?
【发布时间】:2015-04-07 12:52:04
【问题描述】:

这是滑块的脚本:

<script>
    $(function(){
        $('#slides').slides({
            preload: true,
            preloadImage: 'img/loading.gif',
            play: 5000,
            pause: 2500,
            hoverPause: true,
            animationStart: function(current){
                $('.caption').animate({
                    bottom:-35
                },100);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationStart on slide: ', current);
                };
            },
            animationComplete: function(current){
                $('.caption').animate({
                    bottom:0
                },200);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationComplete on slide: ', current);
                };
            },
            slidesLoaded: function() {
                $('.caption').animate({
                    bottom:0
                },200);
            }
        });
    });
</script>

head 部分中添加的上述脚本以及这些

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="js/slides.min.jquery.js"></script>

包含在 head 标签中。

这里是 jsfiddle 链接:http://jsfiddle.net/j88u02o2/

在上面我添加了 html 和 slides.min.jquery.js 文件。

当我在所有代码之上运行时,会显示分页。但我不需要..所以我试图删除它..但我不能。它仍然显示为数字..

我的页面如下所示:http://s28.postimg.org/rs8wlvmwt/Untitled_1.png

我需要,像这个链接 http://securedcommunications.com/ 那样工作幻灯片

谁能帮我实现这一目标。

提前致谢。

【问题讨论】:

  • 请正确制作 Fiddle,以便我可以快速修改它。您请在您的 jsfiddle 链接jsfiddle.net/j88u02o2 上检查自己。它不起作用。
  • 没有问题我自己做的,我正在检查问题jsfiddle.net/j88u02o2/3
  • 您问“如何从 jquery 的滑块中删除分页?” ,我回答了。如需更多功能,您可以提出另一个问题。
  • 您好,在您想要滑块的网站的 URL 中查看,它使用与您的插件不同的滑块插件。它使用 -> securedcommunications.com/Include/js/cross-slide.js 插件。
  • 妈妈,你好,知道了。这就是我们所说的软件工程师/网络开发人员:) -> 你现在明白了吗What are the duties of web dev.?jsfiddle.net/j88u02o2/59,网络开发人员是最聪明的人之一。谢谢

标签: javascript jquery html css pagination


【解决方案1】:

我尝试了分页设置并设置为 false

 pagination: {
  active: false
    // [string] Can be either "slide" or "fade".
 },
 .......................

但它没有用,所以更好的解决方案是在其包装器中使用 display none。

Demo

.pagination{
    display:none;
}

更新

根据新的更新和新的 JS 滑块,Here is DEMO

我所做的是->

$(function() {
        $('#slides').crossSlide({
            speed: 40,
            fade: 1
        }, [
            { src: 'http://securedcommunications.com/Include/Images/home/photo-2.jpg', dir: 'up', alt: 'Our Business is to Encrypt and Secure Your Communications', href: '#'  },
            { src: 'http://securedcommunications.com/Include/Images/home/photo-2.jpg', dir: 'down', alt: 'The Solution for Secured Communications and Privacy.', href: '#'  }
            /*  */
        ], function(idx, img, idxOut, imgOut) {
            if (idxOut == undefined) {
                if(idx == 0 || idx == 3 || idx == 6 || idx == 9){
                    document.getElementById('crossSlideCaption').style.marginTop = '-430px';
                    document.getElementById('crossSlideCaption').style.marginLeft = '-485px';
                }else if(idx == 1 || idx == 4 || idx == 7 || idx == 10 || idx == 12){
                    document.getElementById('crossSlideCaption').style.marginTop = '-280px';
                    document.getElementById('crossSlideCaption').style.marginLeft = '-100px';
                }else{
                    document.getElementById('crossSlideCaption').style.marginTop = '-52px';
                    document.getElementById('crossSlideCaption').style.marginLeft = '-485px';
                };
                $('div.caption').text(img.alt).animate({ opacity: 1.0 })
            } else {
                $('div.caption').animate({ opacity: 0 })
            }});
        $('div.caption').show().css({ opacity: 0 })
    });

HTML

<div id="container">
    <div id="example">
        <div id="slides" style="width:970px;height:430px;"></div>
            <div id="" class="" style="position:relative; width:970px; margin:auto;" align="">
                <div id="crossSlideCaption" class="caption">

        </div>
    </div>
</div>

并在

中添加2个JS文件
  1. http://securedcommunications.com/Include/js/cross-slide.js
  2. http://securedcommunications.com/Include/js/jquery-easing.js

【讨论】:

  • 有点忙以后再看。
  • 我现在在公司做公司工作,我认为插件只支持图像。所以你可以通过编写自己的视频代码来扩展 jQuery 插件! :) 享受
  • @rani 您需要添加视频功能,所以扩展插件! :)
  • @rani mademji 你正在使用这个插件来滑动图像 -> securedcommunications.com/Include/js/cross-slide.js 好的?所以你需要在这个 JS 文件中编写更多代码,这样它也可以与 Video 一起使用。所以如果你知道 Core Javascript 和 jQuery ,修改插件并用于视频。
猜你喜欢
  • 1970-01-01
  • 2014-12-13
  • 1970-01-01
  • 2015-06-26
  • 1970-01-01
  • 1970-01-01
  • 2018-10-17
  • 1970-01-01
  • 2014-01-10
相关资源
最近更新 更多