Uncaught TypeError: $(…).owlCarousel is not a function

前端 未结 4 408
[愿得一人]
[愿得一人] 2021-01-28 20:21

I have added owlCarousel to my page. but im getting this error. and stuck with it hours.. :(

HTML code

function in custom.js

4条回答
  •  失恋的感觉
    2021-01-28 21:06

    this is my custom.js file.

    $(document).ready(function () { /***************** Navbar-Collapse ******************/

    $(window).scroll(function () {
        if ($(".navbar").offset().top > 50) {
            $(".navbar-fixed-top").addClass("top-nav-collapse");
        } else {
            $(".navbar-fixed-top").removeClass("top-nav-collapse");
        }
    });
    
    /***************** Page Scroll ******************/
    
    $(function () {
        $('a.page-scroll').bind('click', function (event) {
            var $anchor = $(this);
            $('html, body').stop().animate({
                scrollTop: $($anchor.attr('href')).offset().top
            }, 1500, 'easeInOutExpo');
            event.preventDefault();
        });
    });
    
    /***************** Scroll Spy ******************/
    
    $('body').scrollspy({
        target: '.navbar-fixed-top',
        offset: 51
    })
    
    /***************** Owl Carousel ******************/
    
    $("#owl-hero").owlCarousel({
    
        navigation: true, // Show next and prev buttons
        slideSpeed: 300,
        paginationSpeed: 400,
        singleItem: true,
        transitionStyle: "fadeUp",
        autoPlay: true,
        navigationText: ["", ""]
    
    });
    
    
    /***************** Full Width Slide ******************/
    
    var slideHeight = $(window).height();
    
    $('#owl-hero .item').css('height', slideHeight);
    
    $(window).resize(function () {
        $('#owl-hero .item').css('height', slideHeight);
    });
    /***************** Owl Carousel Testimonials ******************/
    
    $("#owl-testi").owlCarousel({
    
        navigation: false, // Show next and prev buttons
        paginationSpeed: 400,
        singleItem: true,
        transitionStyle: "backSlide",
        autoPlay: true
    
    });
    /***************** Countdown ******************/
    
    $('#fun-facts').bind('inview', function (event, visible, visiblePartX, visiblePartY) {
        if (visible) {
            $(this).find('.timer').each(function () {
                var $this = $(this);
                $({
                    Counter: 0
                }).animate({
                    Counter: $this.text()
                }, {
                    duration: 2000,
                    easing: 'swing',
                    step: function () {
                        $this.text(Math.ceil(this.Counter));
                    }
                });
            });
            $(this).unbind('inview');
        }
    });
    /***************** Google Map ******************/
    
    function initialize() {
        var mapCanvas = document.getElementById('map');
        var mapOptions = {
            center: new google.maps.LatLng(39.92757, -83.160207),
            zoom: 8,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        var map = new google.maps.Map(mapCanvas, mapOptions);
    }
    
    google.maps.event.addDomListener(window, 'load', initialize);
    
    /***************** Wow.js ******************/
    
    new WOW().init();
    
    /***************** Preloader ******************/
    
    var preloader = $('.preloader');
    $(window).load(function () {
        preloader.remove();
    });
    

    })

提交回复
热议问题