Home » Jquery » javascript – Slick Slider Library Does Not Work On Page Refresh With JQUERY .Load

javascript – Slick Slider Library Does Not Work On Page Refresh With JQUERY .Load

Posted by: admin February 22, 2020 Leave a comment

Questions:

When I press the refresh button in the browser the library doesn’t work anymore here is my index.html

<main >

    <div id="test123">

    </div>

</main>

Here is my javascript file that handles the load and library

loadHomePage();


function loadHomePage() {

    window.onload = function () {
        /** First slider */
        $('.slider-one')
            .not(".slick-intialized")
            .slick({
                autoplay: true,
                autoplaySpeed: 5000,
                dots: true,
                prevArrow: ".site-slider .slider-btn .prev",
                nextArrow: ".site-slider .slider-btn .next"
            });

$("#test123").load("homepage.html");
}

This only works when the page start up for the first time and not when the page refreshes how can I fix this?

How to&Answer: