Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using bootstrap into a WordPress theme and I have a conflict between jQuery in wp-include folder and my theme jQuery

this is my function jQuery that need bootstrap.min.js and jquery.js

jQuery(function($) {'use strict',

//#main-slider
$(function(){
    $('#main-slider.carousel').carousel({
        interval: 8000
    });
}); 
});

how could I resolve this problem ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
304 views
Welcome To Ask or Share your Answers For Others

1 Answer

You have to put jQuery into no-conflict mode to use it along with other JS libraries. For example:

var $j = jQuery.noConflict();
// $j is an alias to the jQuery function

$j(document).ready(function() {
    // ...
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...