Cannot read property 'offsetWidth' of undefined or null reference RRS feed

  • Question

  • Hi,

    I'm getting the error "Cannot read property 'offsetWidth' of undefined or null reference" in my website since I commented out 2 divs in a bootstrap carousel. This carousel was developed by someone else who is unavailable to me. I don't see how commenting out a div would cause this error. It does not occur when the divs are left in.

    The code is below:

    <!-- Carousel -->
    <div id="homepage-slider">
        <div id="feature-wrap">
            <div class="iosSlider">
                <div class="slider">                                                              
                    <div class="item" id="2">
                        <a href="{0}/{1}/products/test1"><img src="{0}/Content/images/home/index/myPic.jpg" style="width: 100%;" /></a>
                    <div class="item" id="3">
                        <a href="{0}/{1}/products/test2"><img src="{0}/Content/images/home/index/myPic2.jpg" style="width: 100%;" /></a>
                    <div class="item" id="4">                    
                        <a href="https://myPage.myCompany.com/" target="_blank"><img src="{0}/Content/images/home/index/myPic3.jpg" style="width: 100%;" /></a>
                    </div>  <!-- Commenting out this div -->                           
                <div class="iosSliderButtons">                
                    <div class="button"></div>
                    <div class="button"></div>
                    <div class="button"></div> <!-- Commenting out this div -->
            <div id="nextSlide"></div>
            <div id="previousSlide"></div>

    This HTML is called from another file, called Index.cshtml like so:

    myHTML1 & myHTML2 are set earlier in the file, and this HTML is then used to populate the placeholders (marked {2} and {3}) in the page above. t=This all works fine when the divs are not commented out, but I don't see how removing a div would cause the error to appear. I also sometimes get a similar error, except it refers to the 'unobtrusive' property. I know these are both Bootstrap functions.

    <div id="view-home">
        @Html.Raw(Resources.HtmlContent.HomePageContent.FormatWith(host, currentWebAlias, myHTML1, myHTML2))

    Any help greatly appreciated!

    Wednesday, November 15, 2017 12:18 PM