jQuery(function ($) { ServicesModuleInitialize(); }); function ServicesModuleInitialize() { $(document).on('s123.page.ready', function (event) { var $section = $('section.s123-module-services'); $section.each(function (index) { var $sectionThis = $(this); var categories = new ModuleLayoutCategories({ $items: $sectionThis.find('.services-category'), $categoriesContainer: $sectionThis.find('.categories-panel'), $filterButton: $sectionThis.find('.items-responsive-filter'), $categories: $sectionThis.find('.items-categories-container li') }); if ($sectionThis.hasClass('layout-10')) { $sectionThis.find('.service-item-description').each(function () { const $paragraph = $(this); const lineHeight = parseFloat($paragraph.css('font-size')) * 1.5; const maxLines = 4; const actualHeight = $paragraph.height(); const numberOfLines = actualHeight / lineHeight; if (numberOfLines > maxLines) { $paragraph.addClass('show-more'); $paragraph.attr('data-rel', 'tooltip'); $paragraph.css('height', lineHeight * maxLines); $paragraph.on('click', function () { var _this = $(this); bootbox.alert({ title: _this.data('title'), message: _this.html(), backdrop: true }); }); } }); } $modulesMobileCarouselViewOBJ = new ModulesMobileCarouselView({ $section: $sectionThis }); }); }); }