Skip to content Skip to sidebar Skip to footer

Script Stops The Execution Of Other Code (slitslider)

I have the following script, but when i move to a page that don't have #slider breaks the code that is below it, what i tried to do is check if the #slider is on the page otherwise

Solution 1:

Actually you might have an dom-element called #slider but don't have included the according slitslider plugin on that page. Also you need to check the length of the array, because $() always returns an array and an empty array (if there is no match) is also truthy. That's why the error Object [object Object] (your slider element) has no method 'slitslider' (missing slitslider function.)

You need to check if($('#slider').length && $().slitslider ) to prevent that.

Post a Comment for "Script Stops The Execution Of Other Code (slitslider)"