Mohammad Asmar Mohammad Asmar - 6 months ago 41
CSS Question

Bootstrap Carousel breaks html layout with XSLT on Sharepoint

I am facing this weird issue, please follow to the rest:

1- I have this static carousel html code: (which is working on browser)

<div class="Awareness-section no-padding col-md-12 col-sm-12 col-xs-12">
<div id="Awareness-carousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#Awareness-carousel" data-slide-to="0" class="active">1</li>
<li data-target="#Awareness-carousel" data-slide-to="1">2</li>
<li data-target="#Awareness-carousel" data-slide-to="2">3</li>
</ol>

<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<p class="Awareness-title">Awareness 1</p>
<p class="Awareness-desc">Content 1</p>
</div>

<div class="item">
<p class="Awareness-title">Awareness 2</p>
<p class="Awareness-desc">Content 2</p>
</div>

<div class="item">
<p class="Awareness-title">Awareness 3</p>
<p class="Awareness-desc">Content 3</p>
</div>
</div>

</div>
<p class="Awareness-view-all"><a href="">View All</a></p>
</div>





2- Then I made it dynamic with sharepoint's content query webpart (XSLT) like this:

<xsl:variable name="BeginColumn" select="string('&lt;div id=&quot;Awareness-carousel&quot; class=&quot;carousel slide&quot;&gt;&lt;!-- Indicators --&gt;&lt;ol class=&quot;carousel-indicators&quot;&gt;&lt;li data-target=&quot;#Awareness-carousel&quot; data-slide-to=&quot;0&quot;&gt;1&lt;/li&gt;&lt;li data-target=&quot;#Awareness-carousel&quot; data-slide-to=&quot;1&quot;&gt;2&lt;/li&gt;&lt;li data-target=&quot;#Awareness-carousel&quot; data-slide-to=&quot;2&quot;&gt;3&lt;/li&gt;&lt;/ol&gt;&lt;!-- Wrapper for slides --&gt;&lt;div class=&quot;carousel-inner&quot; role=&quot;listbox&quot;&gt;')" />
<xsl:variable name="EndColumn" select="string('&lt;!-- Left and right controls --&gt;&lt;a class=&quot;left carousel-control&quot; href=&quot;#Awareness-carousel&quot; role=&quot;button&quot; data-slide=&quot;prev&quot;&gt;&lt;span&gt;&lt;i class=&quot;fa fa-angle-left&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class=&quot;sr-only&quot;&gt;Previous&lt;/span&gt;&lt;/a&gt;&lt;a class=&quot;right carousel-control&quot; href=&quot;#Awareness-carousel&quot; role=&quot;button&quot; data-slide=&quot;next&quot;&gt;&lt;span&gt;&lt;i class=&quot;fa fa-angle-right&quot;&gt;&lt;/i&gt;&lt;/span&gt; &lt;span class=&quot;sr-only&quot;&gt;Next&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;aw-vall&quot;&gt;&lt;p class=&quot;Awareness-view-all&quot;&gt;&lt;a href=&quot;/Arabic/Pages/allawareness.aspx&quot;&gt;&#x639;&#x631;&#x636; &#x627;&#x644;&#x643;&#x644;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;')" />





then
I added it in a webpart zone in the page layout:

<div class="Awareness-section no-padding col-md-12 col-sm-6 col-xs-12">
<WebPartPages:WebPartZone id="AwarenessSection" runat="server" title="Awareness Webpart"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
</div>





3- I am adding 'active' class to first indicator and item, and initializing the carousel manually in the js:

$('.carousel-indicators li:first').addClass("active");
$('.carousel-inner .item:first').addClass("active");
$('#Awareness-carousel').carousel();





4- After all, the carousel worked fine, but the html layout of the page is breaking, the footer is going under the container:




Before adding the carousel:
enter image description here




After adding the carousel:
enter image description here




Please help if anyone has a clue why this happening and what is the solutions to try ?

Answer

From what I can see in the XSLT part there is a div in the BeginColumn that is not closed in the EndColumn.

Adding a &lt;/div&gt; in the beginning EndColumn of should fix your problem.

Comments