Показать сообщение отдельно
  #1 (permalink)  
Старый 01.11.2019, 11:59
Профессор
Отправить личное сообщение для Stas1985 Посмотреть профиль Найти все сообщения от Stas1985
 
Регистрация: 05.03.2012
Сообщений: 159

Пауза при наведении на слайдер
Здравствуйте форумчане!
Столкнулся с такой проблемой. На сайте есть слайдер текста _https://lik-astana.kz/ при наведении он не останавливается, должен при наведении остановится чтоб была возможность прочитать текст, как я понимаю в js файле эта функция прописана
/**
* @author    JoomShaper [url]http://www.joomshaper.com[/url]
* @copyright Copyright (C) 2010 - 2013 JoomShaper
* @license   [url]http://www.gnu.org/licenses/gpl-2.0.html[/url] GNU/GPLv2
*/;
(function ($) {
    var methods = {
        currentIndex: 0,
        prevIndex: 0,
        nextIndex: 0,
        totalItems: 0,
        settings: {},
        canvasWidth: 0,
        canvasHeight: 0,
        elements: '',
        prevIndex: function () {
            var c = this.currentIndex;
            c--;
            if (c < 0)
                c = this.totalItems - 1;
            return c;
        },
        nextIndex: function () {
            var c = this.currentIndex;
            c++;
            if (c >= (this.totalItems))
                c = 0;
            return c;
        },

        currentIndex: function () {
            return this.currentIndex;
        },

        prev: function () {
            clearTimeout(this.autoplay);
            this.currentIndex--;
            if (this.currentIndex < 0) {
                this.currentIndex = this.totalItems - 1;
                this.prevIndex = methods['prevIndex'].call(this);
            }
            var $this = this;
            methods['run'].call(this);
        },

        next: function () {
            clearTimeout(this.autoplay);
            this.currentIndex++;
            if (this.currentIndex >=this.totalItems){
                this.currentIndex = 0;
                this.nextIndex = methods['nextIndex'].call(this);
            }
            methods['run'].call(this);
        },

        play: function () {
            var $this = this;
            this.autoplay = setTimeout(function () {
                methods['next'].call($this);
            }, 1000);
        },

        preloader: function () {
            var loadedImage = new Image();
            var preloadImages = this.settings.preloadImages;
            var $this = this;

            if (this.settings.showPreloader != true || preloadImages.length < 1) {
                $(this.settings.preloader).remove();
                methods['start'].call(this);
                this.elements.trigger('onSlide');
            } else {
                for (i = 0; i < preloadImages.length; i++) loadedImage.src = preloadImages[i];
                    $(loadedImage).load(function () {
                        $($this.settings.preloader).fadeOut('fast', function () {
                            $(this).remove();
                        });
                        methods['start'].call($this);
                        $this.elements.trigger('onSlide');
                    });
            }
        },

        autoplay: function () {
            var $this = this;
            if (this.settings.autoplay == true) {
                this.autoplay = setTimeout(function () {
                    methods['next'].call($this);
                }, this.settings.interval);
            }
        },

        pause: function () {
            clearTimeout(this.autoplay);
        },

        goTo: function (index) {
            clearTimeout(this.autoplay);
            if( this.currentIndex==index ){
                return false;
            }
            this.currentIndex = index;
            methods['run'].call(this);
        },

        run: function () {
            clearTimeout(this.delay);
            clearTimeout(this.autoplay);
            var $this = this;
            var $item = this.items;

            $item.each(function(){
                if( $(this).hasClass($this.settings.animateInClass) ){
                    $(this).removeClass($this.settings.animateInClass).addClass($this.settings.animateOutClass);
                }
            });

            this.delay = setTimeout(function () {
                $item.removeClass($this.settings.animateOutClass);
                $item.eq($this.currentIndex).removeClass($this.settings.animateOutClass).addClass($this.settings.animateInClass);

                $this.elements.trigger('onSlide');
            }, this.settings.delay);

            methods['autoplay'].call(this);
        },

        start: function () {
            clearTimeout(this.delay);
            clearTimeout(this.autoplay);
            var $this = this;
            var $item = this.items;

            this.delay = setTimeout(function () {

                $item.eq($this.currentIndex)
                .removeClass($this.settings.animateOutClass)
                .addClass($this.settings.animateInClass);

                $this.elements.trigger('onSlide');
            }, this.settings.delay);

            methods['autoplay'].call(this);
        },

        resize: function (fn) {
            if (this.settings.fullWidth == true) {
                this.elements.height($(window).width() * this.ratioHeight);
            }
        },

        onSlide: function (fn) {
            var $this = this;
            this.elements.bind('onSlide', function (event) {
                fn($this.currentIndex, $this.items, event);
            });
        },

        init: function (elements, settings) {
            this.currentIndex = 0;
            this.elements = elements;
            this.items = $(elements).find('>*');

            this.totalItems = this.items.length;
            this.settings = settings;

            var $this = this;
            this.items.each(function (i) {
                $(this).addClass($this.settings.itemClassPrefix + (i + 1));
            });
        },

    };

    $.fn.spSmartslider = function (options, param) {

        var settings = $.extend({
            preloadImages: [],
            autoplay: true,
            preloader: '.sp-preloader',
            showPreloader: true,
            interval: 5000,
            delay: 500,
            itemClassPrefix: 'item-',
            rWidth: 0,
            rHeight: 0,
            fullWidth: false,
            animateInClass: 'animate-in',
            animateOutClass: 'animate-out',
        }, options);

        return this.each(function (index, element) {

            if (typeof (options) === 'string') {
                methods[options].call(this, param);
            } else {
                methods['init'].call(this, $(this), settings);
                methods['preloader'].call(this);
                methods['autoplay'].call(this);
                methods['resize'].call(this);
            }
        });
    }
})(jQuery);

Пробовал решить средствами css но это не сработало. Подскажите как решить с помощью js.
Спасибо!

Последний раз редактировалось Stas1985, 31.07.2024 в 10:10.
Ответить с цитированием