I had the same problem and solved it by moving the file inclusion to the page footer.
SlidesJS - TypeError: $(...).slidesjs is not a function
-
02-06-2022 - |
Question
I'm trying to implement the SlidesJS plugin on my site, but when the page loads i get the following error:
TypeError: $(...).slidesjs is not a function
My html is:
<div class="slider">
<div class="container">
<div id="slides">
<img src="<?= img('slides/example-slide-1.jpg') ?>" alt="photo 1">
<img src="<?= img('slides/example-slide-2.jpg') ?>" alt="photo 2">
<img src="<?= img('slides/example-slide-3.jpg') ?>" alt="photo 3">
<img src="<?= img('slides/example-slide-4.jpg') ?>" alt="photo 4">
<a href="#" class="slidesjs-previous slidesjs-navigation"><i class="icon-chevron-left icon-large"></i></a>
<a href="#" class="slidesjs-next slidesjs-navigation"><i class="icon-chevron-right icon-large"></i></a>
</div>
</div>
</div>
My css file contains:
.slider #slides {
display: none;
}
And my js file contains:
$(document).ready(function() {
...
$("#slides").slidesjs({
width: 1000,
height: 290
});
}
I've included both jQuery and the plugin's specific script, but I still get this error. Am I missing anything?
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow