Getting Cannot read property 'offsetWidth' of undefined with bootstrap carousel script

后端 未结 6 2307
悲哀的现实
悲哀的现实 2020-12-01 02:39

I created a carousel with Bootstrap 3.3 and it works on my local machine, but when I upload the whole thing on server where the bootstrap js file i

相关标签:
6条回答
  • 2020-12-01 03:04

    "Change to if (typeof $next == 'object' && $next.length) $next[0].offsetWidth" -did not help. if you convert Bootstrap 3 to php(for WordPress theme), when adding WP_Query ($loop = new WP_Query( $args );) insert $count = 0;. And and at the end before endwhile; add $count++;.

    0 讨论(0)
  • For me, I changed class='carousel-item' to class='item' like this

    <div class="item">
        <img class="img-responsive" src="..." alt="...">
    </div>
    
    0 讨论(0)
  • 2020-12-01 03:06

    I have got the same error, but in my case I wrote class names for carousel item as .carousel-item the bootstrap.css is referring .item. SO ERROR solved. carosel-item is renamed to item

    <div class="carousel-item active"></div>
    

    RENAMED To the following:

    <div class="item active"></div>
    
    0 讨论(0)
  • I got same error. Because i used v4 alpha class names like carousel-control-next When i changed with v3, problem solved.

    0 讨论(0)
  • 2020-12-01 03:19

    Remove the class 'Carousal slide' on page load & add it dynamically when image gets loaded using jquery.This fixed for me

    0 讨论(0)
  • 2020-12-01 03:24

    For me it was because I hadn't set an active class on any of the slides.

    0 讨论(0)
提交回复
热议问题