Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Переключение с карусели и назад в зависимотси от разрешения
- function owlToggle(className, opt, breakpoint) {
- if (window.innerWidth < breakpoint) {
- $(className).each(function() {
- $(this).addClass('owl-carousel owl-theme').owlCarousel(opt);
- });
- } else {
- $(className).removeClass('owl-carousel owl-theme').each(function() {
- $(this).trigger('destroy.owl.carousel').removeAttr('style');
- });
- }
- }
- // Лента табов - пересчет драгдилера
- function reflowTabs(self, child, drag) {
- let parLen = self.outerWidth();
- let len = child.outerWidth();
- if (len <= parLen) {
- if (!child.hasClass('disabled')) {
- drag.disable();
- }
- setTimeout(function() {
- child.attr('style', '');
- }, 10);
- } else {
- drag.enable();
- }
- }
- $(function() {
- // Тэги - табы
- if ($('.tags__stage-outer[id^="tags"]').length) {
- $('.tags__stage-outer[id^="tags"]').each(function() {
- let self = $(this);
- let child = $(this).children();
- let drag = new Dragdealer($(this).attr('id'), {
- handleClass: 'tags__stage'
- });
- reflowTabs(self, child, drag);
- $(window).on('resize orientationchange', () => reflowTabs(self, child, drag));
- });
- }
- // Карусель карточек
- if ($('.info-blocks__slider').length) {
- let slider = $('.info-blocks__slider');
- let options = {
- items: 1,
- dots: false,
- nav: false,
- loop: false,
- margin: 10
- }
- owlToggle(slider, options, 768);
- $(window).on('resize orientationchange', () => owlToggle(slider, options, 768));
- }
- });
Add Comment
Please, Sign In to add comment