Skip to content

Commit 3eab6b3

Browse files
committed
Updated README for new functionality
Added info about the data-callback attribute (and an example on the Related Products tab header) Added an example of activating a lazy-loaded tab on $(document).ready() for MVC if it's the default tab (in this case, #fullDesc)
1 parent f54f495 commit 3eab6b3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If you don't use nuget package manager, just download source code, and copy MT.B
2424

2525
2- add class **.lazyload** to nav-tabs (bootstrap tabs ul tag)
2626

27-
3- add **data-url** to the **anchor** tag of every tab you want to lazyload. this attribute will contain the url of partial pages you want to load it into the tab.
27+
3- add **data-url** to the **anchor** tag of every tab you want to lazyload. this attribute will contain the url of partial pages you want to load it into the tab. The data-callback attribute can be used to specify a javascript function to be called once the load is done (on the .done() event of the $.get)
2828
**Example**
2929

3030

@@ -33,7 +33,17 @@ If you don't use nuget package manager, just download source code, and copy MT.B
3333
<li class="active"><a href="#fullDesc" data-toggle="tab">Description</a></li>
3434
<li><a href="#specificationDetails" data-toggle="tab">Specifications</a></li>
3535
<li><a href="#relatedProducts" data-toggle="tab" data-url="@Url.Action("relatedproducts", new { model.product.id})">Related Products</a></li>
36-
<li><a href="#files" data-toggle="tab" data-url="@Url.Action("getproductfiles", new { model.product.id })">Product Files</a></li>
36+
<li><a href="#files" data-toggle="tab" data-url="@Url.Action("getproductfiles", new { model.product.id })" data-callback="initProducts()">Product Files</a></li>
3737
<li><a href="#videos" data-toggle="tab" data-url="@Url.Action("getproductvideos", new { model.product.id })">Product Videos</a></li>
3838
</ul>
3939

40+
4- If you are lazy loading your initial tab, you can add a trigger('shown.bs.tab') on your initial tab.
41+
**MVC Example on the same page as your tabs**
42+
43+
@section scripts {
44+
<script type="text/javascript">
45+
$(document).ready(function () {
46+
$('.nav-tabs a[href="#fullDesc"]').trigger('shown.bs.tab');
47+
});
48+
</script>
49+
}

0 commit comments

Comments
 (0)