1/** 2 * jquery.owl-filter.js 3 * Create: 07-09-2016 4 * Author: Bearsthemes 5 * Version: 1.0.0 6 */ 7 8"use strict"; 9(function ($) { 10 $.fn.owlRemoveItem = function (num) { 11 var owl_data = $(this).data('owl.carousel'); 12 13 owl_data._items = $.map(owl_data._items, function (data, index) { 14 if (index != num) 15 return data; 16 }) 17 18 $(this).find('.owl-item').eq(num).remove(); 19 } 20 21 $.fn.owlFilter = function (data, callback) { 22 var owl = this, 23 //owl_data = $(owl).data('owlCarousel'), 24 $elemCopy = $('<div>').css('display', 'none'); 25 26 /* check attr owl-clone exist */ 27 if (typeof ($(owl).data('owl-clone')) == 'undefined') { 28 $(owl).find('.owl-item:not(.cloned)').clone().appendTo($elemCopy); 29 $(owl).data('owl-clone', $elemCopy); 30 } else { 31 $elemCopy = $(owl).data('owl-clone'); 32 } 33 34 /* clear content */ 35 owl.trigger('replace.owl.carousel', ['<div/>']); 36 37 switch (data) { 38 case '*': 39 $elemCopy.children().each(function () { 40 owl.trigger('add.owl.carousel', [$(this).children().clone()]); 41 }) 42 break; 43 default: 44 $elemCopy.find(data).each(function () { 45 owl.trigger('add.owl.carousel', [$(this).clone()]); 46 }) 47 break; 48 } 49 50 /* remove item empty when clear */ 51 owl.owlRemoveItem(0); 52 owl.trigger('refresh.owl.carousel').trigger('to.owl.carousel', [0]); 53 54 // callback 55 if (callback) 56 callback.call(this, owl); 57 } 58}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.