Last active
September 12, 2017 07:41
-
-
Save pagemashine/c0bbe9b8b6bd3f979b7353d8d491223d to your computer and use it in GitHub Desktop.
Click function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('.js-openmenu').click(function() { | |
$(this).parent().toggleClass('on-1'); | |
}); | |
$('.js-openmenu-2').click(function() { | |
$(this).parent().toggleClass('on-2'); | |
}); | |
if ($(".js-sale-owlcarousel").length) { | |
var owlConfig = { | |
nav: true, | |
responsive: { | |
0: { | |
items: 1 | |
}, | |
360: { | |
items: 1 | |
}, | |
767: { | |
items: 3 | |
}, | |
979: { | |
items: 4 | |
} | |
} | |
}; | |
$(".js-sale-owlcarousel").owlCarousel(owlConfig); | |
}; | |
var owlCarouselMain = $(".js-main-owlcarousel"); | |
if (owlCarouselMain.length > 0) { | |
var myOwlCarousel = undefined; | |
initOwlCarousel(); | |
$(window).on('resize', function(){ | |
setTimeout(function(){ | |
initOwlCarousel(); | |
},0); | |
}); | |
} | |
function initOwlCarousel() { | |
var screenWidth = $(window).width(); | |
if (screenWidth <= 980 && myOwlCarousel === undefined) { | |
myOwlCarousel = ".js-main-owlcarousel"; | |
if(typeof $(myOwlCarousel).data('owlCarousel') != 'undefined') { | |
$(myOwlCarousel).data('owlCarousel').destroy(); | |
$(myOwlCarousel).removeClass('owl-carousel'); | |
} | |
if ($(myOwlCarousel).length) { | |
$(myOwlCarousel).each(function(idx, elem) { | |
try{ | |
$(elem).owlCarousel({ | |
nav: true, | |
responsive: { | |
0: { | |
items: 1 | |
}, | |
360: { | |
items: 1 | |
}, | |
767: { | |
items: 3 | |
} | |
}, | |
loop: $(elem).children().length > 1 | |
}); | |
} catch (e) { | |
console.error('from custom owl-carousel ' + e.message); | |
} | |
}); | |
}; | |
} else if (screenWidth >= 981 && myOwlCarousel !== undefined) { | |
$(myOwlCarousel).data('owlCarousel').destroy(); | |
$(myOwlCarousel).removeClass('owl-carousel'); | |
$(myOwlCarousel).removeClass('owl-loaded'); | |
myOwlCarousel = undefined; | |
var tempContent = ''; | |
tempContent = tempContent + $(".catalogbox__item").first().parent().html(); | |
$(".js-main-owlcarousel").html(''); | |
$(".js-main-owlcarousel").html(tempContent); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('').on('click', function(event) { | |
event.preventDefault(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment