$(function() { details_ShowMore = function () { var _h = 0; $('.text-body').each(function() { $(this).children('*').each(function() { _h += $(this).outerHeight(true); }); _h > $(this).outerHeight(true) ? $(this).siblings('.more-details').show() : ''; }); $('.details-section').on('click', '.more-details', function(e) { $(this).closest('.details-section').addClass('open'); e.preventDefault(); }); }; details_screenshots = function() { var _imgSrc = [], $screenshotsView = $('
'); $('.screenshots-list img').each(function(i) { i == 0 ? $(this).closest('.screenshots-img').addClass('active') : ''; _imgSrc.push($(this).attr('src')); }); $('.screenshots-list').on('click', '.screenshots-img', function() { $(this).addClass('active').siblings().removeClass('active'); $('.screenshots-view img').addClass('hide').eq($(this).index()).removeClass('hide'); }); $.map(_imgSrc, function(v, i) { $screenshotsView.append(''); }) $('.screenshots-groups').prepend($screenshotsView); }; details_screenshots(); })