jssor / slider

Touch swipe image slider/slideshow/gallery/carousel/banner mobile responsive bootstrap

Home Page:https://www.jssor.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught Error: Outer container 'null' not found.

vdanelia opened this issue · comments

I'm getting this error on the home page only .. In other pages everythging is ok..

Uncaught Error: Outer container 'null' not found.
    at Object.$Fail (jssor.core.js:1)
    at jssor.slider.js:6
    at Object.$Execute (jssor.core.js:1)
    at new JssorSlider (jssor.slider.js:6)
    at HTMLDocument.<anonymous> (jssor.ctrl4.js:1)
    at fire (jquery-1.10.2.js:3048)
    at Object.fireWith [as resolveWith] (jquery-1.10.2.js:3160)
    at Function.ready (jquery-1.10.2.js:433)
    at HTMLDocument.completed (jquery-1.10.2.js:104)

What is the problem?

Thank you In Advanced!

Here Is jssor.core.js

$Jssor$ = window.$Jssor$ = window.$Jssor$ || {};
var $JssorDebug$ = new function() {
    this.$DebugMode = true;
    this.$Log = function(msg, important) {
        var console = window.console || {};
        var debug = this.$DebugMode;
        if (debug && console.log) {
            console.log(msg);
        } else if (debug && important) {
            alert(msg);
        }
    };
    this.$Error = function(msg, e) {
        var console = window.console || {};
        var debug = this.$DebugMode;
        if (debug && console.error) {
            console.error(msg);
        } else if (debug) {
            alert(msg);
        }
        if (debug) {
            throw e || new Error(msg);
        }
    };
    this.$Fail = function(msg) {
        throw new Error(msg);
    };
    this.$Assert = function(value, msg) {
        var debug = this.$DebugMode;
        if (debug) {
            if (!value) throw new Error("Assert failed " + msg || "");
        }
    };
    this.$Trace = function(msg) {
        var console = window.console || {};
        var debug = this.$DebugMode;
        if (debug && console.log) {
            console.log(msg);
        }
    };
    this.$Execute = function(func) {
        var debug = this.$DebugMode;
        if (debug) func();
    };
    this.$LiveStamp = function(obj, id) {
        var stamp = document.createElement("DIV");
        stamp.setAttribute("id", id);
        obj.$Live = stamp;
    };
};
var $JssorEventManager$ = function() {
    var self = this;
    var listeners = {};
    self.$On = self.addEventListener = function(eventName, handler) {
        if (typeof(handler) != "function") {
            return;
        }
        if (!listeners[eventName]) {
            listeners[eventName] = [];
        }
        listeners[eventName].push(handler);
    };
    self.$Off = self.removeEventListener = function(eventName, handler) {
        var handlers = listeners[eventName];
        if (typeof(handler) != "function") {
            return;
        } else if (!handlers) {
            return;
        }
        for (var i = 0; i < handlers.length; i++) {
            if (handler == handlers[i]) {
                handlers.splice(i, 1);
                return;
            }
        }
    };
    self.$ClearEventListeners = function(eventName) {
        if (listeners[eventName]) {
            delete listeners[eventName];
        }
    };
    self.$TriggerEvent = function(eventName) {
        var handlers = listeners[eventName];
        var args = [];
        if (!handlers) {
            return;
        }
        for (var i = 1; i < arguments.length; i++) {
            args.push(arguments[i]);
        }
        for (var i = 0; i < handlers.length; i++) {
            try {
                handlers[i].apply(window, args);
            } catch (e) {
                $JssorDebug$.$Error(e.name + " while executing " + eventName + " handler: " + e.message, e);
            }
        }
    };
};

I think I need to change something here...

commented

Every slider should initialize with outer container element.
For example

<div id="slider1_container" ...>
...
</div>
<script>
        var options = { $AutoPlay: 1 };
        var jssor_slider1 = new $JssorSlider$("slider1_container", options);
</script>

http://jssorpreproduction.azurewebsites.net/development/

Btw, please use the latest version instead of version 19.

Yes, It's good Idea to update your script, I already thought about this...
This is not my code (I'm new with this site) This is php site..
I searched the divs, but here they're using <div id="slider" ...> can't find there <div id="slider1_container" ...>

But strange thing is that sliders are working without any problem....

I have to change many codes there, is there any other way to fix this... to modify the jssor script itself...
Lately I'll update all the Jssor script to final version..

Thank you In Advanced!

commented

each slider should have different id, rename id for every slider then.

commented

also, you can pass the parameter as dom element.

<script>
        var containerElement = document.getElementById("slider1_container");
        var options = { $AutoPlay: 1 };
        var jssor_slider1 = new $JssorSlider$(containerElement, options);
</script>