0

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?

1 Answer 1

5

I had the same problem and solved it by moving the file inclusion to the page footer.

Sign up to request clarification or add additional context in comments.

2 Comments

Your solution works. Don't know who down-voted your answer...I have up-voted your answer. :)
@UjwalaKhaire Thanks! Please mark my answer as the correct one as well, so other people easily can see it's the right one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.