Problem with JavaScript slider carousel

-----slider carousel------

----page I’m trying to add it to…---------

First off… I know all of my images are broken, I have them saved locally. I have two questions about my code…First is very minor. When hovering the nav bar elements, the cursor turns to a pointer on all the elements except my search function…? Why is that?

Second, I am trying to insert a slider carousel with swiper.js. It works in it’s own file but when I tried to integrate it onto my landing page…the javascript isn’t functioning… please help!

Welcome to the forums!

Can you post the code you use to integrate the carousel?

You got a couple of problems:

  1. You forgot to add:
    <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
    to your <head> section in the HTML

  2. This block of code in your JS file:

  $(document).ready(function(){
    $('.search-icon').click(function(){
$('.search-icon').toggleClass('active')//Search Icon Change OnClick
$('.search-box').toggleClass('active')//box show WHen Click Icon
    })
});

is breaking your document. Comment it out and the carousel will work

2 Likes

Ah silly me I didn’t see that I could cycle through his code…

Thank you irlfede. I implemented the changes you suggested and the carousel works! …However, when I commented out the js, the functionality of the search box breaks. (I it have linked to a jquery sheet on my computer and it works(before commenting it out but it breaks the swiper) I don’t know how to fix the js code to keep the functionality. Seems all my troubles are within the block you posted.

(document).ready(function(){ (’.search-icon’).click(function(){
('.search-icon').toggleClass('active')//Search Icon Change OnClick (’.search-box’).toggleClass(‘active’)//box show WHen Click Icon
})
});

…However…when I comment everything out including the jquery link on my home machine the swiper still doesnt load correctly…

I’ll get my GitHub up and functional today so you guys can have a better look at it. Thank you so much for taking the time to help

Not sure if I did this correctly to share or view…