owl carousel extended with tab selection











up vote
-1
down vote

favorite












I need to display different items in the carousel when clicked on different tabs (ex- when clicked on the food tab carousel will display food items and when clicked on the beverages tab, the carousel will display beverages.). I can get different items loaded. But when switching the tabs, the carousel will displayed only under one tab.Can you please point out whats wrong?Im not much expert in Js. And I can understand only some lines in the JS Code.The code may seem long, but it will be easy to read. Please help.Thank you.



My tabs



<ul class="ltabs-tabs cf">
<li class="ltabs-tab "
data-category-id="28"
data-active-content=".items-category-28">
<div class="ltabs-tab-img">
<img src="{{a url}}"
title="food" alt="food"/>
</div>
<span class="ltabs-tab-label">food</span>
</li>

<li class="ltabs-tab tab-sel tab-loaded "
data-category-id="8"
data-active-content=".items-category-8">
<div class="ltabs-tab-img">
<img sr`enter code here`c="{{url}}"
title="drinks" alt="drinks"/>
</div>
<span class="ltabs-tab-label">drinks</span>
</li>
</ul>


My Carousel items



<div class="ltabs-items-container  show-slider">
<!--Begin Items-->
<div class="ltabs-items items-category-28">
<div class="products-grid ltabs-items-inner fadeIn">
{% for product in products %}
<div class="item ltabs-item new-ltabs-item">
<div class="item-inner style3">
<div class="box-image">
<img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
<!--LABEL PRODUCT-->
<div class="label-wrapper">
</div>
<!--END LABEL PRODUCT-->
</div>
<!-- Begin ltabs-content -->
<div class="product details product-item-details box-info">
<h2 class="product name product-item-name product-name">
{{product.name}}</h2>
<div class="ltabs-price">
<div class="sale-price">
<div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
<span class="price-container price-final_price tax weee">
<span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
<span class="price">LKR {{ product.price }}</span>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
<div class="ltabs-loading">
<div class="cssload-square">
<div class="cssload-square-part cssload-square-green"></div>
<div class="cssload-square-part cssload-square-pink"></div>
<div class="cssload-square-blend"></div>
</div>
</div>
</div>

</div>
<div class="ltabs-items items-category-50">
<div class="products-grid ltabs-items-inner fadeIn">
<div class="ltabs-loading">
<div class="cssload-square">
<div class="cssload-square-part cssload-square-green"></div>
<div class="cssload-square-part cssload-square-pink"></div>
<div class="cssload-square-blend"></div>
</div>
</div>
</div>

</div>
<div class="ltabs-items ltabs-items-selected ltabs-items-loaded items-category-8">
<div class="products-grid ltabs-items-inner fadeIn">
{% for product in products %}
<div class="item ltabs-item new-ltabs-item">
<div class="item-inner style3">
<div class="box-image">
<img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
<!--LABEL PRODUCT-->
<div class="label-wrapper">
</div>
<!--END LABEL PRODUCT-->
</div>
<!-- Begin ltabs-content -->
<div class="product details product-item-details box-info">
<h2 class="product name product-item-name product-name">
{{product.name}}</h2>
<div class="ltabs-price">
<div class="sale-price">
<div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
<span class="price-container price-final_price tax weee">
<span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
<span class="price">LKR {{ product.price }}</span>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>


My Java Script



<script type="text/javascript">
//<![CDATA[
require(['jquery','owlcarousel'], function ($, owlCarousel) {
;
(function (element) {
var $element = $(element),
$tab = $('.ltabs-tab', $element),
$tab_label = $('.ltabs-tab-label', $tab),
$tabs = $('.ltabs-tabs', $element),
ajax_url = $tabs.parents('.ltabs-tabs-container').attr('data-ajaxurl'),
effect = $tabs.parents('.ltabs-tabs-container').attr('data-effect'),
delay = $tabs.parents('.ltabs-tabs-container').attr('data-delay'),
duration = $tabs.parents('.ltabs-tabs-container').attr('data-duration'),
rl_moduleid = $tabs.parents('.ltabs-tabs-container').attr('data-modid'),
$items_content = $('.ltabs-items', $element),
$items_inner = $('.ltabs-items-inner', $items_content),
$items_first_active = $('.ltabs-items-selected', $element),
$load_more = $('.ltabs-loadmore', $element),
$btn_loadmore = $('.ltabs-loadmore-btn', $load_more),
$select_box = $('.ltabs-selectbox', $element),
$tab_label_select = $('.ltabs-tab-selected', $element);

enableSelectBoxes();
function enableSelectBoxes() {
$tab_wrap = $('.ltabs-tabs-wrap', $element),
$tab_label_select.html($('.ltabs-tab', $element).filter('.tab-sel').children('.ltabs-tab-label').html());
if ($(window).innerWidth() <= 991) {
$tab_wrap.addClass('ltabs-selectbox');
} else {
$tab_wrap.removeClass('ltabs-selectbox');
}
}

$('span.ltabs-tab-selected, span.ltabs-tab-arrow', $element).click(function () {
if ($('.ltabs-tabs', $element).hasClass('ltabs-open')) {
$('.ltabs-tabs', $element).removeClass('ltabs-open');
} else {
$('.ltabs-tabs', $element).addClass('ltabs-open');
}
});

$(window).resize(function () {
if ($(window).innerWidth() <= 991) {
$('.ltabs-tabs-wrap', $element).addClass('ltabs-selectbox');
} else {
$('.ltabs-tabs-wrap', $element).removeClass('ltabs-selectbox');
}
});

function showAnimateItems(el) {
var $_items = $('.new-ltabs-item', el), nub = 0;
$('.ltabs-loadmore-btn', el).fadeOut('fast');
$_items.each(function (i) {
nub++;
switch (effect) {
case 'none' :
$(this).css({'opacity': '1', 'filter': 'alpha(opacity = 100)'});
break;
default:
animatesItems($(this), nub * delay, i, el);
}
if (i == $_items.length - 1) {
$('.ltabs-loadmore-btn', el).fadeIn(delay);
}
$(this).removeClass('new-ltabs-item');
});
}

function animatesItems($this, fdelay, i, el) {
var $_items = $('.ltabs-item', el);
$this.attr("style",
"-webkit-animation:" + effect + " " + duration + "ms;"
+ "-moz-animation:" + effect + " " + duration + "ms;"
+ "-o-animation:" + effect + " " + duration + "ms;"
+ "-moz-animation-delay:" + fdelay + "ms;"
+ "-webkit-animation-delay:" + fdelay + "ms;"
+ "-o-animation-delay:" + fdelay + "ms;"
+ "animation-delay:" + fdelay + "ms;").delay(fdelay).animate({
opacity: 1,
filter: 'alpha(opacity = 100)'
}, {
//delay: 100
});
if (i == ($_items.length - 1)) {
$(".ltabs-items-inner").addClass("play");
}
}

showAnimateItems($items_first_active);
$tab.on('click.tab', function () {
var $this = $(this);
if ($this.hasClass('tab-sel')) return false;
if ($this.parents('.ltabs-tabs').hasClass('ltabs-open')) {
$this.parents('.ltabs-tabs').removeClass('ltabs-open');
}
$tab.removeClass('tab-sel');
$this.addClass('tab-sel');
var items_active = $this.attr('data-active-content');
var _items_active = $(items_active, $element);
$items_content.removeClass('ltabs-items-selected');
_items_active.addClass('ltabs-items-selected');
$tab_label_select.html($tab.filter('.tab-sel').children('.ltabs-tab-label').html());
var $loading = $('.ltabs-loading', _items_active);
var loaded = _items_active.hasClass('ltabs-items-loaded');

if (!loaded && !_items_active.hasClass('ltabs-process')) {
_items_active.addClass('ltabs-process');
var category_id = $this.attr('data-category-id');
$loading.show();
$.ajax({
type: 'POST',
url: ajax_url,
data: {
listing_tabs_moduleid: rl_moduleid,
is_ajax_listing_tabs: 1,
ajax_listingtags_start: 0,
categoryid: category_id,
config: ''
},
success: function (data) {
if (data.items_markup != '') {
$('.ltabs-items-inner', _items_active).html(data.items_markup);
_items_active.addClass('ltabs-items-loaded').removeClass('ltabs-process');
$loading.remove();
showAnimateItems(_items_active);
updateStatus(_items_active);

CreateProSlider($('.ltabs-items-inner', _items_active));
if(typeof(_SmQuickView) != 'undefined')
_SmQuickView();
if(typeof(loadaJax) != 'undefined')
loadaJax();
}
},
dataType: 'json'
});

} else {


var owl = $('.ltabs-items-inner', _items_active);
owl = owl.data('owlCarousel');
if (typeof owl === 'undefined') {
} else {
owl.onResize();
}
}
});

function updateStatus($el) {
$('.ltabs-loadmore-btn', $el).removeClass('loading');
var countitem = $('.ltabs-item', $el).length;
$('.ltabs-image-loading', $el).css({display: 'none'});
$('.ltabs-loadmore-btn', $el).parent().attr('data-rl_start', countitem);
var rl_total = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_total');
var rl_load = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_load');
var rl_allready = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_allready');

if (countitem >= rl_total) {
$('.ltabs-loadmore-btn', $el).addClass('loaded');
$('.ltabs-image-loading', $el).css({display: 'none'});
$('.ltabs-loadmore-btn', $el).attr('data-label', rl_allready);
$('.ltabs-loadmore-btn', $el).removeClass('loading');
}
}

$btn_loadmore.on('click.loadmore', function () {
var $this = $(this);
if ($this.hasClass('loaded') || $this.hasClass('loading')) {
return false;
} else {
$this.addClass('loading');
$('.ltabs-image-loading', $this).css({display: 'inline-block'});
var rl_start = $this.parent().attr('data-rl_start'),
rl_moduleid = $this.parent().attr('data-modid'),
rl_ajaxurl = $this.parent().attr('data-ajaxurl'),
effect = $this.parent().attr('data-effect'),
category_id = $this.parent().attr('data-categoryid'),
items_active = $this.parent().attr('data-active-content');
var _items_active = $(items_active, $element);
$.ajax({
type: 'POST',
url: rl_ajaxurl,
data: {
listing_tabs_moduleid: rl_moduleid,
is_ajax_listing_tabs: 1,
ajax_listingtags_start: rl_start,
categoryid: category_id,
config:
},
success: function (data) {
if (data.items_markup != '') {
$(data.items_markup).insertAfter($('.ltabs-item', _items_active).nextAll().last());
$('.ltabs-image-loading', $this).css({display: 'none'});
showAnimateItems(_items_active);
updateStatus(_items_active);
if(typeof(_SmQuickView) != 'undefined')
_SmQuickView();
if(typeof(loadaJax) != 'undefined')
loadaJax();
}
}, dataType: 'json'
});
}
return false;
});

if ($('.ltabs-items-inner', $element).parent().hasClass('ltabs-items-selected')) {
var items_active = $('.ltabs-tab.tab-sel', $element).attr('data-active-content');
var _items_active = $(items_active, $element);
CreateProSlider($('.ltabs-items-inner', _items_active));
}

function CreateProSlider($items_inner) {
$items_inner.owlCarousel({
nav: true,
loop: false,
margin: 0,
slideBy: 1,
autoplay: false,
autoplayHoverPause: true,
autoplaySpeed: 1000,
navSpeed: 1000,
startPosition: 0,
mouseDrag:true,
touchDrag:true,
dots: false,
autoWidth: false,
navClass: ['owl-prev', 'owl-next'],
navText: ['‹', '›'],
responsive: {
0: {
items:1 },
480: {
items:1 },
768: {
items:2 },
991: {
items:3 },
1200: {
items:4 }
}
});
}

})('#sm_listing_tabs_547132081542684002');
});
//]]>
</script>









share|improve this question


























    up vote
    -1
    down vote

    favorite












    I need to display different items in the carousel when clicked on different tabs (ex- when clicked on the food tab carousel will display food items and when clicked on the beverages tab, the carousel will display beverages.). I can get different items loaded. But when switching the tabs, the carousel will displayed only under one tab.Can you please point out whats wrong?Im not much expert in Js. And I can understand only some lines in the JS Code.The code may seem long, but it will be easy to read. Please help.Thank you.



    My tabs



    <ul class="ltabs-tabs cf">
    <li class="ltabs-tab "
    data-category-id="28"
    data-active-content=".items-category-28">
    <div class="ltabs-tab-img">
    <img src="{{a url}}"
    title="food" alt="food"/>
    </div>
    <span class="ltabs-tab-label">food</span>
    </li>

    <li class="ltabs-tab tab-sel tab-loaded "
    data-category-id="8"
    data-active-content=".items-category-8">
    <div class="ltabs-tab-img">
    <img sr`enter code here`c="{{url}}"
    title="drinks" alt="drinks"/>
    </div>
    <span class="ltabs-tab-label">drinks</span>
    </li>
    </ul>


    My Carousel items



    <div class="ltabs-items-container  show-slider">
    <!--Begin Items-->
    <div class="ltabs-items items-category-28">
    <div class="products-grid ltabs-items-inner fadeIn">
    {% for product in products %}
    <div class="item ltabs-item new-ltabs-item">
    <div class="item-inner style3">
    <div class="box-image">
    <img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
    <!--LABEL PRODUCT-->
    <div class="label-wrapper">
    </div>
    <!--END LABEL PRODUCT-->
    </div>
    <!-- Begin ltabs-content -->
    <div class="product details product-item-details box-info">
    <h2 class="product name product-item-name product-name">
    {{product.name}}</h2>
    <div class="ltabs-price">
    <div class="sale-price">
    <div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
    <span class="price-container price-final_price tax weee">
    <span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
    <span class="price">LKR {{ product.price }}</span>
    </span>
    </span>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    {% endfor %}
    <div class="ltabs-loading">
    <div class="cssload-square">
    <div class="cssload-square-part cssload-square-green"></div>
    <div class="cssload-square-part cssload-square-pink"></div>
    <div class="cssload-square-blend"></div>
    </div>
    </div>
    </div>

    </div>
    <div class="ltabs-items items-category-50">
    <div class="products-grid ltabs-items-inner fadeIn">
    <div class="ltabs-loading">
    <div class="cssload-square">
    <div class="cssload-square-part cssload-square-green"></div>
    <div class="cssload-square-part cssload-square-pink"></div>
    <div class="cssload-square-blend"></div>
    </div>
    </div>
    </div>

    </div>
    <div class="ltabs-items ltabs-items-selected ltabs-items-loaded items-category-8">
    <div class="products-grid ltabs-items-inner fadeIn">
    {% for product in products %}
    <div class="item ltabs-item new-ltabs-item">
    <div class="item-inner style3">
    <div class="box-image">
    <img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
    <!--LABEL PRODUCT-->
    <div class="label-wrapper">
    </div>
    <!--END LABEL PRODUCT-->
    </div>
    <!-- Begin ltabs-content -->
    <div class="product details product-item-details box-info">
    <h2 class="product name product-item-name product-name">
    {{product.name}}</h2>
    <div class="ltabs-price">
    <div class="sale-price">
    <div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
    <span class="price-container price-final_price tax weee">
    <span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
    <span class="price">LKR {{ product.price }}</span>
    </span>
    </span>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    {% endfor %}
    </div>
    </div>
    </div>


    My Java Script



    <script type="text/javascript">
    //<![CDATA[
    require(['jquery','owlcarousel'], function ($, owlCarousel) {
    ;
    (function (element) {
    var $element = $(element),
    $tab = $('.ltabs-tab', $element),
    $tab_label = $('.ltabs-tab-label', $tab),
    $tabs = $('.ltabs-tabs', $element),
    ajax_url = $tabs.parents('.ltabs-tabs-container').attr('data-ajaxurl'),
    effect = $tabs.parents('.ltabs-tabs-container').attr('data-effect'),
    delay = $tabs.parents('.ltabs-tabs-container').attr('data-delay'),
    duration = $tabs.parents('.ltabs-tabs-container').attr('data-duration'),
    rl_moduleid = $tabs.parents('.ltabs-tabs-container').attr('data-modid'),
    $items_content = $('.ltabs-items', $element),
    $items_inner = $('.ltabs-items-inner', $items_content),
    $items_first_active = $('.ltabs-items-selected', $element),
    $load_more = $('.ltabs-loadmore', $element),
    $btn_loadmore = $('.ltabs-loadmore-btn', $load_more),
    $select_box = $('.ltabs-selectbox', $element),
    $tab_label_select = $('.ltabs-tab-selected', $element);

    enableSelectBoxes();
    function enableSelectBoxes() {
    $tab_wrap = $('.ltabs-tabs-wrap', $element),
    $tab_label_select.html($('.ltabs-tab', $element).filter('.tab-sel').children('.ltabs-tab-label').html());
    if ($(window).innerWidth() <= 991) {
    $tab_wrap.addClass('ltabs-selectbox');
    } else {
    $tab_wrap.removeClass('ltabs-selectbox');
    }
    }

    $('span.ltabs-tab-selected, span.ltabs-tab-arrow', $element).click(function () {
    if ($('.ltabs-tabs', $element).hasClass('ltabs-open')) {
    $('.ltabs-tabs', $element).removeClass('ltabs-open');
    } else {
    $('.ltabs-tabs', $element).addClass('ltabs-open');
    }
    });

    $(window).resize(function () {
    if ($(window).innerWidth() <= 991) {
    $('.ltabs-tabs-wrap', $element).addClass('ltabs-selectbox');
    } else {
    $('.ltabs-tabs-wrap', $element).removeClass('ltabs-selectbox');
    }
    });

    function showAnimateItems(el) {
    var $_items = $('.new-ltabs-item', el), nub = 0;
    $('.ltabs-loadmore-btn', el).fadeOut('fast');
    $_items.each(function (i) {
    nub++;
    switch (effect) {
    case 'none' :
    $(this).css({'opacity': '1', 'filter': 'alpha(opacity = 100)'});
    break;
    default:
    animatesItems($(this), nub * delay, i, el);
    }
    if (i == $_items.length - 1) {
    $('.ltabs-loadmore-btn', el).fadeIn(delay);
    }
    $(this).removeClass('new-ltabs-item');
    });
    }

    function animatesItems($this, fdelay, i, el) {
    var $_items = $('.ltabs-item', el);
    $this.attr("style",
    "-webkit-animation:" + effect + " " + duration + "ms;"
    + "-moz-animation:" + effect + " " + duration + "ms;"
    + "-o-animation:" + effect + " " + duration + "ms;"
    + "-moz-animation-delay:" + fdelay + "ms;"
    + "-webkit-animation-delay:" + fdelay + "ms;"
    + "-o-animation-delay:" + fdelay + "ms;"
    + "animation-delay:" + fdelay + "ms;").delay(fdelay).animate({
    opacity: 1,
    filter: 'alpha(opacity = 100)'
    }, {
    //delay: 100
    });
    if (i == ($_items.length - 1)) {
    $(".ltabs-items-inner").addClass("play");
    }
    }

    showAnimateItems($items_first_active);
    $tab.on('click.tab', function () {
    var $this = $(this);
    if ($this.hasClass('tab-sel')) return false;
    if ($this.parents('.ltabs-tabs').hasClass('ltabs-open')) {
    $this.parents('.ltabs-tabs').removeClass('ltabs-open');
    }
    $tab.removeClass('tab-sel');
    $this.addClass('tab-sel');
    var items_active = $this.attr('data-active-content');
    var _items_active = $(items_active, $element);
    $items_content.removeClass('ltabs-items-selected');
    _items_active.addClass('ltabs-items-selected');
    $tab_label_select.html($tab.filter('.tab-sel').children('.ltabs-tab-label').html());
    var $loading = $('.ltabs-loading', _items_active);
    var loaded = _items_active.hasClass('ltabs-items-loaded');

    if (!loaded && !_items_active.hasClass('ltabs-process')) {
    _items_active.addClass('ltabs-process');
    var category_id = $this.attr('data-category-id');
    $loading.show();
    $.ajax({
    type: 'POST',
    url: ajax_url,
    data: {
    listing_tabs_moduleid: rl_moduleid,
    is_ajax_listing_tabs: 1,
    ajax_listingtags_start: 0,
    categoryid: category_id,
    config: ''
    },
    success: function (data) {
    if (data.items_markup != '') {
    $('.ltabs-items-inner', _items_active).html(data.items_markup);
    _items_active.addClass('ltabs-items-loaded').removeClass('ltabs-process');
    $loading.remove();
    showAnimateItems(_items_active);
    updateStatus(_items_active);

    CreateProSlider($('.ltabs-items-inner', _items_active));
    if(typeof(_SmQuickView) != 'undefined')
    _SmQuickView();
    if(typeof(loadaJax) != 'undefined')
    loadaJax();
    }
    },
    dataType: 'json'
    });

    } else {


    var owl = $('.ltabs-items-inner', _items_active);
    owl = owl.data('owlCarousel');
    if (typeof owl === 'undefined') {
    } else {
    owl.onResize();
    }
    }
    });

    function updateStatus($el) {
    $('.ltabs-loadmore-btn', $el).removeClass('loading');
    var countitem = $('.ltabs-item', $el).length;
    $('.ltabs-image-loading', $el).css({display: 'none'});
    $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_start', countitem);
    var rl_total = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_total');
    var rl_load = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_load');
    var rl_allready = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_allready');

    if (countitem >= rl_total) {
    $('.ltabs-loadmore-btn', $el).addClass('loaded');
    $('.ltabs-image-loading', $el).css({display: 'none'});
    $('.ltabs-loadmore-btn', $el).attr('data-label', rl_allready);
    $('.ltabs-loadmore-btn', $el).removeClass('loading');
    }
    }

    $btn_loadmore.on('click.loadmore', function () {
    var $this = $(this);
    if ($this.hasClass('loaded') || $this.hasClass('loading')) {
    return false;
    } else {
    $this.addClass('loading');
    $('.ltabs-image-loading', $this).css({display: 'inline-block'});
    var rl_start = $this.parent().attr('data-rl_start'),
    rl_moduleid = $this.parent().attr('data-modid'),
    rl_ajaxurl = $this.parent().attr('data-ajaxurl'),
    effect = $this.parent().attr('data-effect'),
    category_id = $this.parent().attr('data-categoryid'),
    items_active = $this.parent().attr('data-active-content');
    var _items_active = $(items_active, $element);
    $.ajax({
    type: 'POST',
    url: rl_ajaxurl,
    data: {
    listing_tabs_moduleid: rl_moduleid,
    is_ajax_listing_tabs: 1,
    ajax_listingtags_start: rl_start,
    categoryid: category_id,
    config:
    },
    success: function (data) {
    if (data.items_markup != '') {
    $(data.items_markup).insertAfter($('.ltabs-item', _items_active).nextAll().last());
    $('.ltabs-image-loading', $this).css({display: 'none'});
    showAnimateItems(_items_active);
    updateStatus(_items_active);
    if(typeof(_SmQuickView) != 'undefined')
    _SmQuickView();
    if(typeof(loadaJax) != 'undefined')
    loadaJax();
    }
    }, dataType: 'json'
    });
    }
    return false;
    });

    if ($('.ltabs-items-inner', $element).parent().hasClass('ltabs-items-selected')) {
    var items_active = $('.ltabs-tab.tab-sel', $element).attr('data-active-content');
    var _items_active = $(items_active, $element);
    CreateProSlider($('.ltabs-items-inner', _items_active));
    }

    function CreateProSlider($items_inner) {
    $items_inner.owlCarousel({
    nav: true,
    loop: false,
    margin: 0,
    slideBy: 1,
    autoplay: false,
    autoplayHoverPause: true,
    autoplaySpeed: 1000,
    navSpeed: 1000,
    startPosition: 0,
    mouseDrag:true,
    touchDrag:true,
    dots: false,
    autoWidth: false,
    navClass: ['owl-prev', 'owl-next'],
    navText: ['‹', '›'],
    responsive: {
    0: {
    items:1 },
    480: {
    items:1 },
    768: {
    items:2 },
    991: {
    items:3 },
    1200: {
    items:4 }
    }
    });
    }

    })('#sm_listing_tabs_547132081542684002');
    });
    //]]>
    </script>









    share|improve this question
























      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I need to display different items in the carousel when clicked on different tabs (ex- when clicked on the food tab carousel will display food items and when clicked on the beverages tab, the carousel will display beverages.). I can get different items loaded. But when switching the tabs, the carousel will displayed only under one tab.Can you please point out whats wrong?Im not much expert in Js. And I can understand only some lines in the JS Code.The code may seem long, but it will be easy to read. Please help.Thank you.



      My tabs



      <ul class="ltabs-tabs cf">
      <li class="ltabs-tab "
      data-category-id="28"
      data-active-content=".items-category-28">
      <div class="ltabs-tab-img">
      <img src="{{a url}}"
      title="food" alt="food"/>
      </div>
      <span class="ltabs-tab-label">food</span>
      </li>

      <li class="ltabs-tab tab-sel tab-loaded "
      data-category-id="8"
      data-active-content=".items-category-8">
      <div class="ltabs-tab-img">
      <img sr`enter code here`c="{{url}}"
      title="drinks" alt="drinks"/>
      </div>
      <span class="ltabs-tab-label">drinks</span>
      </li>
      </ul>


      My Carousel items



      <div class="ltabs-items-container  show-slider">
      <!--Begin Items-->
      <div class="ltabs-items items-category-28">
      <div class="products-grid ltabs-items-inner fadeIn">
      {% for product in products %}
      <div class="item ltabs-item new-ltabs-item">
      <div class="item-inner style3">
      <div class="box-image">
      <img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
      <!--LABEL PRODUCT-->
      <div class="label-wrapper">
      </div>
      <!--END LABEL PRODUCT-->
      </div>
      <!-- Begin ltabs-content -->
      <div class="product details product-item-details box-info">
      <h2 class="product name product-item-name product-name">
      {{product.name}}</h2>
      <div class="ltabs-price">
      <div class="sale-price">
      <div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
      <span class="price-container price-final_price tax weee">
      <span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
      <span class="price">LKR {{ product.price }}</span>
      </span>
      </span>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      {% endfor %}
      <div class="ltabs-loading">
      <div class="cssload-square">
      <div class="cssload-square-part cssload-square-green"></div>
      <div class="cssload-square-part cssload-square-pink"></div>
      <div class="cssload-square-blend"></div>
      </div>
      </div>
      </div>

      </div>
      <div class="ltabs-items items-category-50">
      <div class="products-grid ltabs-items-inner fadeIn">
      <div class="ltabs-loading">
      <div class="cssload-square">
      <div class="cssload-square-part cssload-square-green"></div>
      <div class="cssload-square-part cssload-square-pink"></div>
      <div class="cssload-square-blend"></div>
      </div>
      </div>
      </div>

      </div>
      <div class="ltabs-items ltabs-items-selected ltabs-items-loaded items-category-8">
      <div class="products-grid ltabs-items-inner fadeIn">
      {% for product in products %}
      <div class="item ltabs-item new-ltabs-item">
      <div class="item-inner style3">
      <div class="box-image">
      <img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
      <!--LABEL PRODUCT-->
      <div class="label-wrapper">
      </div>
      <!--END LABEL PRODUCT-->
      </div>
      <!-- Begin ltabs-content -->
      <div class="product details product-item-details box-info">
      <h2 class="product name product-item-name product-name">
      {{product.name}}</h2>
      <div class="ltabs-price">
      <div class="sale-price">
      <div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
      <span class="price-container price-final_price tax weee">
      <span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
      <span class="price">LKR {{ product.price }}</span>
      </span>
      </span>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      {% endfor %}
      </div>
      </div>
      </div>


      My Java Script



      <script type="text/javascript">
      //<![CDATA[
      require(['jquery','owlcarousel'], function ($, owlCarousel) {
      ;
      (function (element) {
      var $element = $(element),
      $tab = $('.ltabs-tab', $element),
      $tab_label = $('.ltabs-tab-label', $tab),
      $tabs = $('.ltabs-tabs', $element),
      ajax_url = $tabs.parents('.ltabs-tabs-container').attr('data-ajaxurl'),
      effect = $tabs.parents('.ltabs-tabs-container').attr('data-effect'),
      delay = $tabs.parents('.ltabs-tabs-container').attr('data-delay'),
      duration = $tabs.parents('.ltabs-tabs-container').attr('data-duration'),
      rl_moduleid = $tabs.parents('.ltabs-tabs-container').attr('data-modid'),
      $items_content = $('.ltabs-items', $element),
      $items_inner = $('.ltabs-items-inner', $items_content),
      $items_first_active = $('.ltabs-items-selected', $element),
      $load_more = $('.ltabs-loadmore', $element),
      $btn_loadmore = $('.ltabs-loadmore-btn', $load_more),
      $select_box = $('.ltabs-selectbox', $element),
      $tab_label_select = $('.ltabs-tab-selected', $element);

      enableSelectBoxes();
      function enableSelectBoxes() {
      $tab_wrap = $('.ltabs-tabs-wrap', $element),
      $tab_label_select.html($('.ltabs-tab', $element).filter('.tab-sel').children('.ltabs-tab-label').html());
      if ($(window).innerWidth() <= 991) {
      $tab_wrap.addClass('ltabs-selectbox');
      } else {
      $tab_wrap.removeClass('ltabs-selectbox');
      }
      }

      $('span.ltabs-tab-selected, span.ltabs-tab-arrow', $element).click(function () {
      if ($('.ltabs-tabs', $element).hasClass('ltabs-open')) {
      $('.ltabs-tabs', $element).removeClass('ltabs-open');
      } else {
      $('.ltabs-tabs', $element).addClass('ltabs-open');
      }
      });

      $(window).resize(function () {
      if ($(window).innerWidth() <= 991) {
      $('.ltabs-tabs-wrap', $element).addClass('ltabs-selectbox');
      } else {
      $('.ltabs-tabs-wrap', $element).removeClass('ltabs-selectbox');
      }
      });

      function showAnimateItems(el) {
      var $_items = $('.new-ltabs-item', el), nub = 0;
      $('.ltabs-loadmore-btn', el).fadeOut('fast');
      $_items.each(function (i) {
      nub++;
      switch (effect) {
      case 'none' :
      $(this).css({'opacity': '1', 'filter': 'alpha(opacity = 100)'});
      break;
      default:
      animatesItems($(this), nub * delay, i, el);
      }
      if (i == $_items.length - 1) {
      $('.ltabs-loadmore-btn', el).fadeIn(delay);
      }
      $(this).removeClass('new-ltabs-item');
      });
      }

      function animatesItems($this, fdelay, i, el) {
      var $_items = $('.ltabs-item', el);
      $this.attr("style",
      "-webkit-animation:" + effect + " " + duration + "ms;"
      + "-moz-animation:" + effect + " " + duration + "ms;"
      + "-o-animation:" + effect + " " + duration + "ms;"
      + "-moz-animation-delay:" + fdelay + "ms;"
      + "-webkit-animation-delay:" + fdelay + "ms;"
      + "-o-animation-delay:" + fdelay + "ms;"
      + "animation-delay:" + fdelay + "ms;").delay(fdelay).animate({
      opacity: 1,
      filter: 'alpha(opacity = 100)'
      }, {
      //delay: 100
      });
      if (i == ($_items.length - 1)) {
      $(".ltabs-items-inner").addClass("play");
      }
      }

      showAnimateItems($items_first_active);
      $tab.on('click.tab', function () {
      var $this = $(this);
      if ($this.hasClass('tab-sel')) return false;
      if ($this.parents('.ltabs-tabs').hasClass('ltabs-open')) {
      $this.parents('.ltabs-tabs').removeClass('ltabs-open');
      }
      $tab.removeClass('tab-sel');
      $this.addClass('tab-sel');
      var items_active = $this.attr('data-active-content');
      var _items_active = $(items_active, $element);
      $items_content.removeClass('ltabs-items-selected');
      _items_active.addClass('ltabs-items-selected');
      $tab_label_select.html($tab.filter('.tab-sel').children('.ltabs-tab-label').html());
      var $loading = $('.ltabs-loading', _items_active);
      var loaded = _items_active.hasClass('ltabs-items-loaded');

      if (!loaded && !_items_active.hasClass('ltabs-process')) {
      _items_active.addClass('ltabs-process');
      var category_id = $this.attr('data-category-id');
      $loading.show();
      $.ajax({
      type: 'POST',
      url: ajax_url,
      data: {
      listing_tabs_moduleid: rl_moduleid,
      is_ajax_listing_tabs: 1,
      ajax_listingtags_start: 0,
      categoryid: category_id,
      config: ''
      },
      success: function (data) {
      if (data.items_markup != '') {
      $('.ltabs-items-inner', _items_active).html(data.items_markup);
      _items_active.addClass('ltabs-items-loaded').removeClass('ltabs-process');
      $loading.remove();
      showAnimateItems(_items_active);
      updateStatus(_items_active);

      CreateProSlider($('.ltabs-items-inner', _items_active));
      if(typeof(_SmQuickView) != 'undefined')
      _SmQuickView();
      if(typeof(loadaJax) != 'undefined')
      loadaJax();
      }
      },
      dataType: 'json'
      });

      } else {


      var owl = $('.ltabs-items-inner', _items_active);
      owl = owl.data('owlCarousel');
      if (typeof owl === 'undefined') {
      } else {
      owl.onResize();
      }
      }
      });

      function updateStatus($el) {
      $('.ltabs-loadmore-btn', $el).removeClass('loading');
      var countitem = $('.ltabs-item', $el).length;
      $('.ltabs-image-loading', $el).css({display: 'none'});
      $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_start', countitem);
      var rl_total = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_total');
      var rl_load = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_load');
      var rl_allready = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_allready');

      if (countitem >= rl_total) {
      $('.ltabs-loadmore-btn', $el).addClass('loaded');
      $('.ltabs-image-loading', $el).css({display: 'none'});
      $('.ltabs-loadmore-btn', $el).attr('data-label', rl_allready);
      $('.ltabs-loadmore-btn', $el).removeClass('loading');
      }
      }

      $btn_loadmore.on('click.loadmore', function () {
      var $this = $(this);
      if ($this.hasClass('loaded') || $this.hasClass('loading')) {
      return false;
      } else {
      $this.addClass('loading');
      $('.ltabs-image-loading', $this).css({display: 'inline-block'});
      var rl_start = $this.parent().attr('data-rl_start'),
      rl_moduleid = $this.parent().attr('data-modid'),
      rl_ajaxurl = $this.parent().attr('data-ajaxurl'),
      effect = $this.parent().attr('data-effect'),
      category_id = $this.parent().attr('data-categoryid'),
      items_active = $this.parent().attr('data-active-content');
      var _items_active = $(items_active, $element);
      $.ajax({
      type: 'POST',
      url: rl_ajaxurl,
      data: {
      listing_tabs_moduleid: rl_moduleid,
      is_ajax_listing_tabs: 1,
      ajax_listingtags_start: rl_start,
      categoryid: category_id,
      config:
      },
      success: function (data) {
      if (data.items_markup != '') {
      $(data.items_markup).insertAfter($('.ltabs-item', _items_active).nextAll().last());
      $('.ltabs-image-loading', $this).css({display: 'none'});
      showAnimateItems(_items_active);
      updateStatus(_items_active);
      if(typeof(_SmQuickView) != 'undefined')
      _SmQuickView();
      if(typeof(loadaJax) != 'undefined')
      loadaJax();
      }
      }, dataType: 'json'
      });
      }
      return false;
      });

      if ($('.ltabs-items-inner', $element).parent().hasClass('ltabs-items-selected')) {
      var items_active = $('.ltabs-tab.tab-sel', $element).attr('data-active-content');
      var _items_active = $(items_active, $element);
      CreateProSlider($('.ltabs-items-inner', _items_active));
      }

      function CreateProSlider($items_inner) {
      $items_inner.owlCarousel({
      nav: true,
      loop: false,
      margin: 0,
      slideBy: 1,
      autoplay: false,
      autoplayHoverPause: true,
      autoplaySpeed: 1000,
      navSpeed: 1000,
      startPosition: 0,
      mouseDrag:true,
      touchDrag:true,
      dots: false,
      autoWidth: false,
      navClass: ['owl-prev', 'owl-next'],
      navText: ['‹', '›'],
      responsive: {
      0: {
      items:1 },
      480: {
      items:1 },
      768: {
      items:2 },
      991: {
      items:3 },
      1200: {
      items:4 }
      }
      });
      }

      })('#sm_listing_tabs_547132081542684002');
      });
      //]]>
      </script>









      share|improve this question













      I need to display different items in the carousel when clicked on different tabs (ex- when clicked on the food tab carousel will display food items and when clicked on the beverages tab, the carousel will display beverages.). I can get different items loaded. But when switching the tabs, the carousel will displayed only under one tab.Can you please point out whats wrong?Im not much expert in Js. And I can understand only some lines in the JS Code.The code may seem long, but it will be easy to read. Please help.Thank you.



      My tabs



      <ul class="ltabs-tabs cf">
      <li class="ltabs-tab "
      data-category-id="28"
      data-active-content=".items-category-28">
      <div class="ltabs-tab-img">
      <img src="{{a url}}"
      title="food" alt="food"/>
      </div>
      <span class="ltabs-tab-label">food</span>
      </li>

      <li class="ltabs-tab tab-sel tab-loaded "
      data-category-id="8"
      data-active-content=".items-category-8">
      <div class="ltabs-tab-img">
      <img sr`enter code here`c="{{url}}"
      title="drinks" alt="drinks"/>
      </div>
      <span class="ltabs-tab-label">drinks</span>
      </li>
      </ul>


      My Carousel items



      <div class="ltabs-items-container  show-slider">
      <!--Begin Items-->
      <div class="ltabs-items items-category-28">
      <div class="products-grid ltabs-items-inner fadeIn">
      {% for product in products %}
      <div class="item ltabs-item new-ltabs-item">
      <div class="item-inner style3">
      <div class="box-image">
      <img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
      <!--LABEL PRODUCT-->
      <div class="label-wrapper">
      </div>
      <!--END LABEL PRODUCT-->
      </div>
      <!-- Begin ltabs-content -->
      <div class="product details product-item-details box-info">
      <h2 class="product name product-item-name product-name">
      {{product.name}}</h2>
      <div class="ltabs-price">
      <div class="sale-price">
      <div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
      <span class="price-container price-final_price tax weee">
      <span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
      <span class="price">LKR {{ product.price }}</span>
      </span>
      </span>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      {% endfor %}
      <div class="ltabs-loading">
      <div class="cssload-square">
      <div class="cssload-square-part cssload-square-green"></div>
      <div class="cssload-square-part cssload-square-pink"></div>
      <div class="cssload-square-blend"></div>
      </div>
      </div>
      </div>

      </div>
      <div class="ltabs-items items-category-50">
      <div class="products-grid ltabs-items-inner fadeIn">
      <div class="ltabs-loading">
      <div class="cssload-square">
      <div class="cssload-square-part cssload-square-green"></div>
      <div class="cssload-square-part cssload-square-pink"></div>
      <div class="cssload-square-blend"></div>
      </div>
      </div>
      </div>

      </div>
      <div class="ltabs-items ltabs-items-selected ltabs-items-loaded items-category-8">
      <div class="products-grid ltabs-items-inner fadeIn">
      {% for product in products %}
      <div class="item ltabs-item new-ltabs-item">
      <div class="item-inner style3">
      <div class="box-image">
      <img src="{{ asset(vich_uploader_asset(product, 'imageFile'))}}"/>
      <!--LABEL PRODUCT-->
      <div class="label-wrapper">
      </div>
      <!--END LABEL PRODUCT-->
      </div>
      <!-- Begin ltabs-content -->
      <div class="product details product-item-details box-info">
      <h2 class="product name product-item-name product-name">
      {{product.name}}</h2>
      <div class="ltabs-price">
      <div class="sale-price">
      <div class="price-box price-final_price" data-role="priceBox" data-product-id="1566">
      <span class="price-container price-final_price tax weee">
      <span id="product-price-1566" data-price-amount="84500" data-price-type="finalPrice" class="price-wrapper ">
      <span class="price">LKR {{ product.price }}</span>
      </span>
      </span>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      {% endfor %}
      </div>
      </div>
      </div>


      My Java Script



      <script type="text/javascript">
      //<![CDATA[
      require(['jquery','owlcarousel'], function ($, owlCarousel) {
      ;
      (function (element) {
      var $element = $(element),
      $tab = $('.ltabs-tab', $element),
      $tab_label = $('.ltabs-tab-label', $tab),
      $tabs = $('.ltabs-tabs', $element),
      ajax_url = $tabs.parents('.ltabs-tabs-container').attr('data-ajaxurl'),
      effect = $tabs.parents('.ltabs-tabs-container').attr('data-effect'),
      delay = $tabs.parents('.ltabs-tabs-container').attr('data-delay'),
      duration = $tabs.parents('.ltabs-tabs-container').attr('data-duration'),
      rl_moduleid = $tabs.parents('.ltabs-tabs-container').attr('data-modid'),
      $items_content = $('.ltabs-items', $element),
      $items_inner = $('.ltabs-items-inner', $items_content),
      $items_first_active = $('.ltabs-items-selected', $element),
      $load_more = $('.ltabs-loadmore', $element),
      $btn_loadmore = $('.ltabs-loadmore-btn', $load_more),
      $select_box = $('.ltabs-selectbox', $element),
      $tab_label_select = $('.ltabs-tab-selected', $element);

      enableSelectBoxes();
      function enableSelectBoxes() {
      $tab_wrap = $('.ltabs-tabs-wrap', $element),
      $tab_label_select.html($('.ltabs-tab', $element).filter('.tab-sel').children('.ltabs-tab-label').html());
      if ($(window).innerWidth() <= 991) {
      $tab_wrap.addClass('ltabs-selectbox');
      } else {
      $tab_wrap.removeClass('ltabs-selectbox');
      }
      }

      $('span.ltabs-tab-selected, span.ltabs-tab-arrow', $element).click(function () {
      if ($('.ltabs-tabs', $element).hasClass('ltabs-open')) {
      $('.ltabs-tabs', $element).removeClass('ltabs-open');
      } else {
      $('.ltabs-tabs', $element).addClass('ltabs-open');
      }
      });

      $(window).resize(function () {
      if ($(window).innerWidth() <= 991) {
      $('.ltabs-tabs-wrap', $element).addClass('ltabs-selectbox');
      } else {
      $('.ltabs-tabs-wrap', $element).removeClass('ltabs-selectbox');
      }
      });

      function showAnimateItems(el) {
      var $_items = $('.new-ltabs-item', el), nub = 0;
      $('.ltabs-loadmore-btn', el).fadeOut('fast');
      $_items.each(function (i) {
      nub++;
      switch (effect) {
      case 'none' :
      $(this).css({'opacity': '1', 'filter': 'alpha(opacity = 100)'});
      break;
      default:
      animatesItems($(this), nub * delay, i, el);
      }
      if (i == $_items.length - 1) {
      $('.ltabs-loadmore-btn', el).fadeIn(delay);
      }
      $(this).removeClass('new-ltabs-item');
      });
      }

      function animatesItems($this, fdelay, i, el) {
      var $_items = $('.ltabs-item', el);
      $this.attr("style",
      "-webkit-animation:" + effect + " " + duration + "ms;"
      + "-moz-animation:" + effect + " " + duration + "ms;"
      + "-o-animation:" + effect + " " + duration + "ms;"
      + "-moz-animation-delay:" + fdelay + "ms;"
      + "-webkit-animation-delay:" + fdelay + "ms;"
      + "-o-animation-delay:" + fdelay + "ms;"
      + "animation-delay:" + fdelay + "ms;").delay(fdelay).animate({
      opacity: 1,
      filter: 'alpha(opacity = 100)'
      }, {
      //delay: 100
      });
      if (i == ($_items.length - 1)) {
      $(".ltabs-items-inner").addClass("play");
      }
      }

      showAnimateItems($items_first_active);
      $tab.on('click.tab', function () {
      var $this = $(this);
      if ($this.hasClass('tab-sel')) return false;
      if ($this.parents('.ltabs-tabs').hasClass('ltabs-open')) {
      $this.parents('.ltabs-tabs').removeClass('ltabs-open');
      }
      $tab.removeClass('tab-sel');
      $this.addClass('tab-sel');
      var items_active = $this.attr('data-active-content');
      var _items_active = $(items_active, $element);
      $items_content.removeClass('ltabs-items-selected');
      _items_active.addClass('ltabs-items-selected');
      $tab_label_select.html($tab.filter('.tab-sel').children('.ltabs-tab-label').html());
      var $loading = $('.ltabs-loading', _items_active);
      var loaded = _items_active.hasClass('ltabs-items-loaded');

      if (!loaded && !_items_active.hasClass('ltabs-process')) {
      _items_active.addClass('ltabs-process');
      var category_id = $this.attr('data-category-id');
      $loading.show();
      $.ajax({
      type: 'POST',
      url: ajax_url,
      data: {
      listing_tabs_moduleid: rl_moduleid,
      is_ajax_listing_tabs: 1,
      ajax_listingtags_start: 0,
      categoryid: category_id,
      config: ''
      },
      success: function (data) {
      if (data.items_markup != '') {
      $('.ltabs-items-inner', _items_active).html(data.items_markup);
      _items_active.addClass('ltabs-items-loaded').removeClass('ltabs-process');
      $loading.remove();
      showAnimateItems(_items_active);
      updateStatus(_items_active);

      CreateProSlider($('.ltabs-items-inner', _items_active));
      if(typeof(_SmQuickView) != 'undefined')
      _SmQuickView();
      if(typeof(loadaJax) != 'undefined')
      loadaJax();
      }
      },
      dataType: 'json'
      });

      } else {


      var owl = $('.ltabs-items-inner', _items_active);
      owl = owl.data('owlCarousel');
      if (typeof owl === 'undefined') {
      } else {
      owl.onResize();
      }
      }
      });

      function updateStatus($el) {
      $('.ltabs-loadmore-btn', $el).removeClass('loading');
      var countitem = $('.ltabs-item', $el).length;
      $('.ltabs-image-loading', $el).css({display: 'none'});
      $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_start', countitem);
      var rl_total = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_total');
      var rl_load = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_load');
      var rl_allready = $('.ltabs-loadmore-btn', $el).parent().attr('data-rl_allready');

      if (countitem >= rl_total) {
      $('.ltabs-loadmore-btn', $el).addClass('loaded');
      $('.ltabs-image-loading', $el).css({display: 'none'});
      $('.ltabs-loadmore-btn', $el).attr('data-label', rl_allready);
      $('.ltabs-loadmore-btn', $el).removeClass('loading');
      }
      }

      $btn_loadmore.on('click.loadmore', function () {
      var $this = $(this);
      if ($this.hasClass('loaded') || $this.hasClass('loading')) {
      return false;
      } else {
      $this.addClass('loading');
      $('.ltabs-image-loading', $this).css({display: 'inline-block'});
      var rl_start = $this.parent().attr('data-rl_start'),
      rl_moduleid = $this.parent().attr('data-modid'),
      rl_ajaxurl = $this.parent().attr('data-ajaxurl'),
      effect = $this.parent().attr('data-effect'),
      category_id = $this.parent().attr('data-categoryid'),
      items_active = $this.parent().attr('data-active-content');
      var _items_active = $(items_active, $element);
      $.ajax({
      type: 'POST',
      url: rl_ajaxurl,
      data: {
      listing_tabs_moduleid: rl_moduleid,
      is_ajax_listing_tabs: 1,
      ajax_listingtags_start: rl_start,
      categoryid: category_id,
      config:
      },
      success: function (data) {
      if (data.items_markup != '') {
      $(data.items_markup).insertAfter($('.ltabs-item', _items_active).nextAll().last());
      $('.ltabs-image-loading', $this).css({display: 'none'});
      showAnimateItems(_items_active);
      updateStatus(_items_active);
      if(typeof(_SmQuickView) != 'undefined')
      _SmQuickView();
      if(typeof(loadaJax) != 'undefined')
      loadaJax();
      }
      }, dataType: 'json'
      });
      }
      return false;
      });

      if ($('.ltabs-items-inner', $element).parent().hasClass('ltabs-items-selected')) {
      var items_active = $('.ltabs-tab.tab-sel', $element).attr('data-active-content');
      var _items_active = $(items_active, $element);
      CreateProSlider($('.ltabs-items-inner', _items_active));
      }

      function CreateProSlider($items_inner) {
      $items_inner.owlCarousel({
      nav: true,
      loop: false,
      margin: 0,
      slideBy: 1,
      autoplay: false,
      autoplayHoverPause: true,
      autoplaySpeed: 1000,
      navSpeed: 1000,
      startPosition: 0,
      mouseDrag:true,
      touchDrag:true,
      dots: false,
      autoWidth: false,
      navClass: ['owl-prev', 'owl-next'],
      navText: ['‹', '›'],
      responsive: {
      0: {
      items:1 },
      480: {
      items:1 },
      768: {
      items:2 },
      991: {
      items:3 },
      1200: {
      items:4 }
      }
      });
      }

      })('#sm_listing_tabs_547132081542684002');
      });
      //]]>
      </script>






      javascript html owl-carousel






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 at 4:55









      Oshana Dissanayake

      12




      12





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386468%2fowl-carousel-extended-with-tab-selection%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386468%2fowl-carousel-extended-with-tab-selection%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin