0

Hubspot 在其自定义模块周围添加了包装器。我非常想找到一种方法让这段代码适用于 Bootstrap 轮播。任何想法如何让轮播插件知道在这个添加的 Hubspot span 和 div 包装器中定位我的项目类?

<div class="carousel-inner">        

    <!-- this is added by Hubspot wraps all items -->
    <span id="hs_cos_wrapper_carousel_items" class="hs_cos_wrapper hs_cos_wrapper_widget_container hs_cos_wrapper_type_widget_container" style="" data-hs-cos-general-type="widget_container" data-hs-cos-type="widget_container">

        <!-- this div is added by Hubspot on each item -->
        <div id="hs_cos_wrapper_widget_1462360389044" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_custom_widget" style="" data-hs-cos-general-type="widget" data-hs-cos-type="custom_widget">

             <!-- finally, we have the carousel items here -->
             <div class="item">
                 <div class="hero" style="height: 765px; min-height: 300px; background-image: url(image.jpg);"></div><!-- end hero-->
                 <div class="container carousel-caption">Test hero</div>
             </div><!-- carousel item -->

        </div>   <!-- added Hubspot div around each item div -->

    </span>  <!-- added Hubspot span -->      

</div>  <!-- carousel-inner div -->
4

1 回答 1

1

我这样做的方法是从自定义模块中删除“项目”。而是用 jquery 将每个自定义模块包装在其中。例如,将包含模块的列指定为“bootstrap-flex”类。然后添加这个:

$('.bootstrap-flex > span').wrapInner("<div class='carousel-inner'></div>");
$('.carousel-inner .hs_cos_wrapper_type_custom_widget').each(function() {
$(this).wrap("<div class='item'></div>");
});
于 2016-05-16T13:22:31.787 回答