Bootstrap3.js and WordPress jQuery v1.10.2 do not work properly

I have a problem with Bootstrap.js 3. More precisely, my problem is with collapse.js for menu scrolling function and jquery library from WordPress 1.3.7.

I would like to use jquery from WP. When I enqueue bootstrap js, scrolling simply doesn’t work. If I delete WordPress jquery.js from wp-includes/js/jquery and add an older version of JQuery (i.e: v1.9.1) the scrolling function works great!

Read More

Is that possible that boostrap.js has some conflict with new jquery.js?

This is my code in functions.php

function my_scripts() {
    wp_enqueue_script( 'jquery');   
    wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.js',   array('jquery'), true );
}

 add_action( 'wp_enqueue_scripts', 'my_scripts' );

Thanks in advance

Related posts

Leave a Reply

1 comment

  1. It is because of jQuery’s no conflict mode. You need to have following statement in between jQuery script inclusion and bootstrap script inclusion

    var $ = jQuery.noConflict();
    

    or go to wp-includes/js/jquery and delete or comment last statement which is like

    jQuery.noConflict();