(function ( $ ) { //setTimeout(hideURLbar(), 0); $.fn.showMore = function (options) { "use strict"; var currentelem = 1; this.each(function(){ var currentid = ''; var element = $(this); var auto = parseInt(element.innerHeight())/2; var fullheight = element.innerHeight() + 20; var settings = $.extend({ minheight: auto, buttontxtmore: "show more", buttontxtless: "show less", buttoncss: "showmore-button", animationspeed: auto }, options ); var toggleHeight=settings.minheight; element.attr('id') != undefined ? currentid = element.attr('id') : currentid = currentelem; element.wrap( "
" ); console.log(fullheight + " - " + toggleHeight); if (element.parent().not('[data-showmore]')) { if (fullheight > (toggleHeight + 50)) { element.css('height', toggleHeight).css('overflow', 'hidden').addClass('toggle-closed'); var showMoreButton = $("", { id: "showmore-button-"+currentid, "class": settings.buttoncss, click: function() { console.log('clicked'); if (element.hasClass('toggle-closed')) { element.removeClass('toggle-closed').addClass('toggle-opened'); element.animate({height:fullheight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtless);element.css('height', '100%'); }); //element.css('height', settings.minheight).css('max-height', '').animate({height:fullheight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtless); }); } else { element.removeClass('toggle-opened').addClass('toggle-closed'); element.animate({height:toggleHeight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtmore); }); //element.animate({height:settings.minheight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtmore); element.css('max-height', settings.minheight); }); } }, html: settings.buttontxtmore }); element.after(showMoreButton); } currentelem++; } }); return this; }; }(jQuery)); jQuery(document).ready(function() { var numItems = jQuery('li.fancyTab').length; if (numItems == 12) { jQuery("li.fancyTab").width('8.3%'); } if (numItems == 11) { jQuery("li.fancyTab").width('9%'); } if (numItems == 10) { jQuery("li.fancyTab").width('10%'); } if (numItems == 9) { jQuery("li.fancyTab").width('11.1%'); } if (numItems == 8) { jQuery("li.fancyTab").width('12.5%'); } if (numItems == 7) { jQuery("li.fancyTab").width('14.2%'); } if (numItems == 6) { jQuery("li.fancyTab").width('16.666666666666667%'); } if (numItems == 5) { jQuery("li.fancyTab").width('20%'); } if (numItems == 4) { jQuery("li.fancyTab").width('25%'); } if (numItems == 3) { jQuery("li.fancyTab").width('33.3%'); } if (numItems == 2) { jQuery("li.fancyTab").width('50%'); } if(window.screen.width <= 768){ setTimeout(function(){ jQuery('.showmore').showMore({ minheight: 240, buttontxtmore: '...Show More', buttontxtless: '...Show Less', animationspeed: 600 }); },1000); } jQuery(".accordionBox .accordion_text").hide(); jQuery(".accordionBox .accordion-box").click(function(e){ //e.preventDefault(); jQuery(this).toggleClass("active").next().slideToggle("normal"); }); var $header = jQuery('header.header-wrap').outerHeight(); //jQuery('.main-content .wrap').css('padding-top', $header+20 + 'px'); }); jQuery(window).load(function () { jQuery('.fancyTabs').each(function () { var highestBox = 0; jQuery('.fancyTab a', this).each(function () { if (jQuery(this).height() > highestBox) highestBox = jQuery(this).height(); }); jQuery('.fancyTab a', this).height(highestBox); }); }); jQuery( window ).resize(function() { jQuery('#showmore-1 .showmore').css('height', 'auto').css('overflow', 'visible').addClass('toggle-opened'); if(window.screen.width <= 768){ if (jQuery('#showmore-1').length == 0) { setTimeout(function(){ jQuery('.showmore').showMore({ minheight: 240, buttontxtmore: '...Show More', buttontxtless: '...Show Less', animationspeed: 600 }); },1000); }else { jQuery('#showmore-1 .showmore').css('height', '240px').css('overflow', 'hidden').addClass('toggle-closed'); jQuery('#showmore-1 .showmore-button').html("show more"); } } });