krizzu Posted October 14, 2016 Share Posted October 14, 2016 Hi! I have a little problem with my presta, i found out that after switching from grid to list view i got "undefined" title field. Any ideas how to solve that problem ? Example: https://goo.gl/xVU0AY Link to comment Share on other sites More sharing options...
vekia Posted October 14, 2016 Share Posted October 14, 2016 problem is in global.js (or product-list.tpl) javascript cant get the name of the product because of different class names probably. - turn of ccc for js files, case needs inspection - what is the ps version ? Link to comment Share on other sites More sharing options...
krizzu Posted October 14, 2016 Author Share Posted October 14, 2016 Thanks for quick reply - ccc turned off, nothing happened - 1.6.1.6 Link to comment Share on other sites More sharing options...
krizzu Posted October 17, 2016 Author Share Posted October 17, 2016 It kinda weird because it worked, i didnt made any changes. I paste product-list.tpl and global.js if you can take a look. product-list.tpl {if isset($products) && $products} {*define number of products per line in other page for desktop*} {if $page_name !='category'} {if ($hide_left_column || $hide_right_column) && ($hide_left_column !='true' || $hide_right_column !='true')} {* left or right column *} {assign var='nbItemsPerLine' value=3} {assign var='nbItemsPerLineTablet' value=2} {assign var='nbItemsPerLineMobile' value=2} {elseif ($hide_left_column && $hide_right_column) && ($hide_left_column =='true' && $hide_right_column =='true')} {* no columns *} {assign var='nbItemsPerLine' value=4} {assign var='nbItemsPerLineTablet' value=3} {assign var='nbItemsPerLineMobile' value=2} {else} {* left and right column *} {assign var='nbItemsPerLine' value=2} {assign var='nbItemsPerLineTablet' value=1} {assign var='nbItemsPerLineMobile' value=2} {/if} {else} {* category page *} {assign var='nbItemsPerLine' value=3} {assign var='nbItemsPerLineTablet' value=2} {assign var='nbItemsPerLineMobile' value=2} {/if} {*define numbers of product per line in other page for tablet*} {assign var='nbLi' value=$products|@count} {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines} {math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet} <!-- Products list --> <ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}"> {foreach from=$products item=product name=products} {math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo} {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet} {math equation="(total%perLineM)" total=$smarty.foreach.products.total perLineM=$nbItemsPerLineMobile assign=totModuloMobile} {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if} {if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if} {if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if} <li class="ajax_block_product col-xs-12 col-sm-{12/$nbItemsPerLineTablet} col-md-{12/$nbItemsPerLine}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} last-in-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} first-in-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)} last-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 0} last-item-of-tablet-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 1} first-item-of-tablet-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} last-item-of-mobile-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} first-item-of-mobile-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}"> <div class="product-container" itemscope itemtype="https://schema.org/Product"> <div class="left-block"> <div class="product-image-container"> <a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url"> <img class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'tm_home_default')|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" itemprop="image" /> {hook h="displayProductListImages" product=$product} </a> {if isset($quick_view) && $quick_view} <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}"> <span>{l s='Quick view'}</span> </a> {/if} <div class="label-container"> {if isset($product.new) && $product.new == 1} <a class="new-box" href="{$product.link|escape:'html':'UTF-8'}"> <span class="new-label">{l s='New'}</span> </a> {/if} {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <a class="sale-box" href="{$product.link|escape:'html':'UTF-8'}"> <span class="sale-label">{l s='Sale!'}</span> </a> {/if} </div> <!-- <div class="button-container"> {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE} {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)} {capture}add=1&id_product={$product.id_product|intval}{if isset($product.id_product_attribute) && $product.id_product_attribute}&ipa={$product.id_product_attribute|intval}{/if}{if isset($static_token)}&token={$static_token}{/if}{/capture} <a class="ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product-attribute="{$product.id_product_attribute|intval}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}"> <span>{l s='Add to cart'}</span> </a> {else} <span class="ajax_add_to_cart_button btn btn-default disabled"> <span>{l s='Add to cart'}</span> </span> {/if} {/if} </div>--> </div> {if isset($product.is_virtual) && !$product.is_virtual}{hook h="displayProductDeliveryTime" product=$product}{/if} {hook h="displayProductPriceBlock" product=$product type="weight"} </div> <div class="right-block"> <div class="product_title_name"> <div class="product_title_name_div" itemprop="name"> {if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if} <a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" > <span class="list-name">{$product.name|truncate:100:'...'|escape:'html':'UTF-8'}</span> <span class="grid-name">{$product.name|truncate:150:'...'|escape:'html':'UTF-8'}</span> </a> </div> </div> {hook h='displayProductListReviews' product=$product} <p class="product-desc" itemprop="description"> <span class="list-desc">{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}</span> <span class="grid-desc">{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}</span> </p> {if (!$PS_CATALOG_MODE && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))} <div class="content_price" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)} {hook h="displayProductPriceBlock" product=$product type="before_price"} <span class="price product-price{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} product-price-new{/if}"> {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} </span> <meta itemprop="priceCurrency" content="{$currency->iso_code}" /> {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} {hook h="displayProductPriceBlock" product=$product type="old_price"} <span class="old-price product-price"> {displayWtPrice p=$product.price_without_reduction} </span> {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"} {if $product.specific_prices.reduction_type == 'percentage'} <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span> {/if} {/if} {hook h="displayProductPriceBlock" product=$product type="price"} {hook h="displayProductPriceBlock" product=$product type="unit_price"} {hook h="displayProductPriceBlock" product=$product type='after_price'} {/if} </div> {/if} {if isset($product.color_list)} <div class="color-list-container">{$product.color_list}</div> {/if} <div class="product-flags"> {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))} {if isset($product.online_only) && $product.online_only} <span class="online_only">{l s='Online only'}</span> {/if} {/if} {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span class="discount">{l s='Reduced price!'}</span> {/if} </div> {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))} {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)} <span class="availability"> {if ($product.allow_oosp || $product.quantity > 0)} <span class="{if $product.quantity <= 0 && isset($product.allow_oosp) && !$product.allow_oosp} label-danger{elseif $product.quantity <= 0} label-warning{else} label-success{/if}"> {if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if} </span> {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)} <span class="label-warning"> {l s='Product available with different options'} </span> {else} <span class="label-danger"> {l s='Out of stock'} </span> {/if} </span> {/if} {/if} </div> <div class="functional-buttons clearfix"> <div class="list-button"> <div class="button-container"> {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE} {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)} {capture}add=1&id_product={$product.id_product|intval}{if isset($product.id_product_attribute) && $product.id_product_attribute}&ipa={$product.id_product_attribute|intval}{/if}{if isset($static_token)}&token={$static_token}{/if}{/capture} <a class="ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product-attribute="{$product.id_product_attribute|intval}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}"> <span>{l s='Add to cart'}</span> </a> {else} <span class="ajax_add_to_cart_button btn btn-default disabled"> <span>{l s='Add to cart'}</span> </span> {/if} {/if} <a itemprop="url" class="lnk_view btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}"> <span>{if (isset($product.customization_required) && $product.customization_required)}{l s='Customize'}{else}{l s='More'}{/if}</span> </a> </div> </div> {hook h='displayProductListFunctionalButtons' product=$product} {if isset($comparator_max_item) && $comparator_max_item} <div class="compare"> <a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}" title="{l s='Add to Compare'}">{l s='Add to Compare'}</a> </div> {/if} </div> </div><!-- .product-container> --> </li> {/foreach} </ul> {addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL} {addJsDefL name=max_item}{l s='You cannot add more than %d product(s) to the product comparison' sprintf=$comparator_max_item js=1}{/addJsDefL} {addJsDef comparator_max_item=$comparator_max_item} {addJsDef comparedProductsIds=$compared_products} {addJsDef nbItemsPerLine=$nbItemsPerLine} {addJsDef nbItemsPerLineTablet=$nbItemsPerLineTablet} {addJsDef nbItemsPerLineMobile=$nbItemsPerLineMobile} {/if} global.js //global variables var responsiveflag = false; var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent); var isiPad = /iPad/i.test(navigator.userAgent); $(document).ready(function(){ controller = new ScrollMagic(); highdpiInit(); responsiveResize(); $(window).resize(responsiveResize); if (navigator.userAgent.match(/Android/i)) { var viewport = document.querySelector('meta[name="viewport"]'); viewport.setAttribute('content', 'initial-scale=1.0,maximum-scale=1.0,user-scalable=0,width=device-width,height=device-height'); window.scrollTo(0, 1); } blockHover(); if (typeof quickView !== 'undefined' && quickView) quick_view(); dropDown(); if (typeof page_name != 'undefined' && !in_array(page_name, ['index', 'product'])) { bindGrid(); $(document).on('change', '.selectProductSort', function(e){ if (typeof request != 'undefined' && request) var requestSortProducts = request; var splitData = $(this).val().split(':'); var url = ''; if (typeof requestSortProducts != 'undefined' && requestSortProducts) { url += requestSortProducts ; if (typeof splitData[0] !== 'undefined' && splitData[0]) { url += ( requestSortProducts.indexOf('?') < 0 ? '?' : '&') + 'orderby=' + splitData[0] + (splitData[1] ? '&orderway=' + splitData[1] : ''); if (typeof splitData[1] !== 'undefined' && splitData[1]) url += '&orderway=' + splitData[1]; } document.location.href = url; } }); $(document).on('change', 'select[name="n"]', function(){ $(this.form).submit(); }); $(document).on('change', 'select[name="currency_payment"]', function(){ setCurrency($(this).val()); }); } $(document).on('change', 'select[name="manufacturer_list"], select[name="supplier_list"]', function() { if (this.value != '') location.href = this.value; }); $(document).on('click', '.back', function(e){ e.preventDefault(); history.back(); }); jQuery.curCSS = jQuery.css; if (!!$.prototype.cluetip) $('a.cluetip').cluetip({ local:true, cursor: 'pointer', dropShadow: false, dropShadowSteps: 0, showTitle: false, tracking: true, sticky: false, mouseOutClose: true, fx: { open: 'fadeIn', openSpeed: 'fast' } }).css('opacity', 0.8); if (!!$.prototype.fancybox) $.extend($.fancybox.defaults.tpl, { closeBtn : '<a title="' + FancyboxI18nClose + '" class="fancybox-item fancybox-close" href="javascript:;"></a>', next : '<a title="' + FancyboxI18nNext + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', prev : '<a title="' + FancyboxI18nPrev + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>' }); // Close Alert messages $(".alert.alert-danger").on('click', this, function(e){ if (e.offsetX >= 16 && e.offsetX <= 39 && e.offsetY >= 16 && e.offsetY <= 34) $(this).fadeOut(); }); }); function highdpiInit() { if($('.replace-2x').css('font-size') == "1px") { var els = $("img.replace-2x").get(); for(var i = 0; i < els.length; i++) { src = els[i].src; extension = src.substr( (src.lastIndexOf('.') +1) ); src = src.replace("." + extension, "2x." + extension); var img = new Image(); img.src = src; img.height != 0 ? els[i].src = src : els[i].src = els[i].src; } } } // Used to compensante Chrome/Safari bug (they don't care about scroll bar for width) function scrollCompensate() { var inner = document.createElement('p'); inner.style.width = "100%"; inner.style.height = "200px"; var outer = document.createElement('div'); outer.style.position = "absolute"; outer.style.top = "0px"; outer.style.left = "0px"; outer.style.visibility = "hidden"; outer.style.width = "200px"; outer.style.height = "150px"; outer.style.overflow = "hidden"; outer.appendChild(inner); document.body.appendChild(outer); var w1 = inner.offsetWidth; outer.style.overflow = 'scroll'; var w2 = inner.offsetWidth; if (w1 == w2) w2 = outer.clientWidth; document.body.removeChild(outer); return (w1 - w2); } function responsiveResize() { compensante = scrollCompensate(); if (($(window).width()+scrollCompensate()) <= 767 && responsiveflag == false) { accordion('enable'); accordionFooter('enable'); responsiveflag = true; } else if (($(window).width()+scrollCompensate()) >= 768) { accordion('disable'); accordionFooter('disable'); responsiveflag = false; if (typeof bindUniform !=='undefined') bindUniform(); } } function blockHover(status) { $(document).off('mouseenter').on('mouseenter', '.product_list.grid li.ajax_block_product .product-container', function(e){ if ('ontouchstart' in document.documentElement) return; if ($('body').find('.container').width() >= 1170) { //var pcHeight = $(this).parent().outerHeight(); //var pcPHeight = $(this).parent().find('.button-container').outerHeight() + $(this).parent().find('.comments_note').outerHeight() + $(this).parent().find('.functional-buttons').outerHeight(); $(this).parent().addClass('hovered'); //$(this).parent().css('height', pcHeight + pcPHeight).css('margin-bottom', pcPHeight * (-1)); } }); $(document).off('mouseleave').on('mouseleave', '.product_list.grid li.ajax_block_product .product-container', function(e){ if ($('body').find('.container').width() == 1170) $(this).parent().removeClass('hovered'); }); } function quick_view() { $(document).on('click', '.quick-view:visible, .quick-view-mobile:visible', function(e) { e.preventDefault(); var url = this.rel; var anchor = ''; if (url.indexOf('#') != -1) { anchor = url.substring(url.indexOf('#'), url.length); url = url.substring(0, url.indexOf('#')); } if (url.indexOf('?') != -1) url += '&'; else url += '?'; if (!!$.prototype.fancybox) $.fancybox({ 'padding': 0, 'width': 900, 'height': 500, 'type': 'iframe', 'href': url + 'content_only=1' + anchor }); }); } function bindGrid() { var view = $.totalStorage('display'); if (!view && (typeof displayList != 'undefined') && displayList) view = 'list'; if (view && view != 'grid') display(view); else $('.display').find('li#grid').addClass('selected'); if($('body#category').hasClass('three-columns')){ display('list'); $('ul.display').addClass('hidden'); } $(document).on('click', '#grid', function(e){ e.preventDefault(); display('grid'); }); $(document).on('click', '#list', function(e){ e.preventDefault(); display('list'); }); } if(nbItemsPerLine != 'undefined' && nbItemsPerLineTablet != 'undefined') {var nbItemsPerLine = nbItemsPerLine; var nbItemsPerLineTablet = nbItemsPerLineTablet}else{var nbItemsPerLine =''; var nbItemsPerLineTablet ='';} function display(view) { if (view == 'list') { $('ul.product_list').removeClass('grid').addClass('list row'); $('.product_list > li').removeClass('col-xs-12 col-sm-'+12/nbItemsPerLineTablet+' col-md-'+ 12/nbItemsPerLine).addClass('col-xs-12'); $('.product_list > li').each(function(index, element) { var html = ''; html = '<div class="product-container"><div class="row">'; html += '<div class="left-block col-xs-4 col-xs-5 col-md-4">' + $(element).find('.left-block').html() + '</div>'; html += '<div class="center-block col-xs-4 col-xs-7 col-md-4">'; html += '<div class="product-flags">'+ $(element).find('.product-flags').html() + '</div>'; html += '<h5 itemprop="name">'+ $(element).find('h5').html() + '</h5>'; var rating = $(element).find('.comments_note').html(); // check : rating if (rating != null) { html += '<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating" class="comments_note">'+ rating + '</div>'; } html += '<p class="product-desc">'+ $(element).find('.product-desc').html() + '</p>'; var colorList = $(element).find('.color-list-container').html(); if (colorList != null) { html += '<div class="color-list-container">'+ colorList +'</div>'; } var availability = $(element).find('.availability').html(); // check : catalog mode is enabled if (availability != null) { html += '<span class="availability">'+ availability +'</span>'; } html += '</div>'; html += '<div class="right-block col-xs-4 col-xs-12 col-md-4"><div class="right-block-content row">'; var price = $(element).find('.content_price').html(); // check : catalog mode is enabled if (price != null) { html += '<div class="content_price col-xs-5 col-md-12">'+ price + '</div>'; } html += '<div class="functional-buttons clearfix col-sm-12">' + $(element).find('.functional-buttons').html() + '</div>'; html += '</div>'; html += '</div></div>'; $(element).html(html); }); $('.display').find('li#list').addClass('selected'); $('.display').find('li#grid').removeAttr('class'); listTabsAnimate('ul.product_list>li'); $.totalStorage('display', 'list'); } else { $('ul.product_list').removeClass('list').addClass('grid row'); $('.product_list > li').removeClass('col-xs-12').addClass('col-xs-12 col-sm-'+12/nbItemsPerLineTablet+' col-md-' + 12/nbItemsPerLine); $('.product_list > li').each(function(index, element) { html = ''; html += '<div class="product-container">'; html += '<div class="left-block">' + $(element).find('.left-block').html() + '</div>'; html += '<div class="right-block">'; html += '<div class="product-flags">'+ $(element).find('.product-flags').html() + '</div>'; html += '<h5 itemprop="name">'+ $(element).find('h5').html() + '</h5>'; var rating = $(element).find('.comments_note').html(); // check : rating if (rating != null) { html += '<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating" class="comments_note">'+ rating + '</div>'; } html += '<p itemprop="description" class="product-desc">'+ $(element).find('.product-desc').html() + '</p>'; var price = $(element).find('.content_price').html(); // check : catalog mode is enabled if (price != null) { html += '<div class="content_price">'+ price + '</div>'; } var colorList = $(element).find('.color-list-container').html(); if (colorList != null) { html += '<div class="color-list-container">'+ colorList +'</div>'; } var availability = $(element).find('.availability').html(); // check : catalog mode is enabled if (availability != null) { html += '<span class="availability">'+ availability +'</span>'; } html += '</div>'; html += '<div class="functional-buttons clearfix">' + $(element).find('.functional-buttons').html() + '</div>'; html += '</div>'; $(element).html(html); }); $('.display').find('li#grid').addClass('selected'); $('.display').find('li#list').removeAttr('class'); listTabsAnimate('ul.product_list>li'); $.totalStorage('display', 'grid'); } } function dropDown() { elementClick = '#header .current'; elementSlide = 'ul.toogle_content'; activeClass = 'active'; $(elementClick).on('click', function(e){ e.stopPropagation(); var subUl = $(this).next(elementSlide); if(subUl.is(':hidden')) { subUl.slideDown(); $(this).addClass(activeClass); } else { subUl.slideUp(); $(this).removeClass(activeClass); } $(elementClick).not(this).next(elementSlide).slideUp(); $(elementClick).not(this).removeClass(activeClass); e.preventDefault(); }); $(elementSlide).on('click', function(e){ e.stopPropagation(); }); $(document).on('click', function(e){ e.stopPropagation(); if (e.which != 3) { var elementHide = $(elementClick).next(elementSlide); $(elementHide).slideUp(); $(elementClick).removeClass('active'); } }); } function accordionFooter(status) { if(status == 'enable') { $('#footer .footer-block h4').on('click', function(){ $(this).toggleClass('active').parent().find('.toggle-footer').stop().slideToggle('medium'); }) $('#footer').addClass('accordion').find('.toggle-footer').slideUp('fast'); } else { $('.footer-block h4').removeClass('active').off().parent().find('.toggle-footer').removeAttr('style').slideDown('fast'); $('#footer').removeClass('accordion'); } } // TOGGLE COLUMNS function accordion(status){ if(status == 'enable'){ $('#right_column .block:not(#layered_block_left) .title_block, #left_column .block:not(#layered_block_left) .title_block, #left_column #newsletter_block_left h4').on('click', function(){ $(this).toggleClass('active').parent().find('.block_content').stop().slideToggle('medium'); }) $('#right_column, #left_column').addClass('accordion').find('.block:not(#layered_block_left) .block_content').slideUp('fast'); if (typeof(ajaxCart) !== 'undefined') ajaxCart.collapse(); }else{ $('#right_column .block:not(#layered_block_left) .title_block, #left_column .block:not(#layered_block_left) .title_block, #left_column #newsletter_block_left h4').removeClass('active').off().parent().find('.block_content').removeAttr('style').slideDown('fast'); $('#left_column, #right_column').removeClass('accordion'); } } function bindUniform() { if (!!$.prototype.uniform) $("select.form-control,input[type='radio'],input[type='checkbox']").not(".not_unifrom").uniform(); } function listBlocksAnimate(block,element,row,offset,difEffect){ if(!isMobile && jQuery(block).length) { var i = 0; var j = row; var k = 1; var effect = -1; $(element).each(function() { i++; if(i>j){ j += row; k = i; effect = effect*(-1); } effect == -1 && difEffect == true?ef = TweenMax.from(element+':nth-child('+i+')', 0.5, {left:-1*200-i*300+"px", alpha: 0, ease:Power1.easeOut}):ef = TweenMax.from(element+':nth-child('+i+')', 0.5, {right:-1*200-i*300+"px", alpha: 0, ease:Power1.easeOut}); var scene_new = new ScrollScene({ triggerElement: element+':nth-child('+k+')', offset: offset, }).setTween(ef) .addTo(controller) .reverse(false); }); } } function listTabsAnimate(element){ if(!isMobile && jQuery(element).length) { TweenMax.staggerFromTo(element, 0.3, {alpha: 0, rotationY:-90, ease:Power1.easeOut},{alpha: 1, rotationY:0, ease:Power1.easeOut}, 0.1); } } $(window).load(function(){ listTabsAnimate('ul.product_list:not(".tab-pane")>li'); listBlocksAnimate('#homefeatured', '#homefeatured li', nbItemsPerLine, -300, true); listBlocksAnimate('#homepage-blog', '#homepage-blog li', nbItemsPerLine, -300, true); }); // TOGGLE SITEMAP $(document).ready(function(){ $('#sitemap #center_column ul.tree > li > ul').addClass('accordion_content').parent().find('> a').wrap("<p class='page-subheading accordion_current'></p>"); $('#center_column .accordion_current').on('click', function(){ $(this).toggleClass('active').parent().find('.accordion_content').stop().slideToggle('medium'); }) $('#center_column').addClass('accordionBox').find('.accordion_content').slideUp('fast'); if (typeof(ajaxCart) !== 'undefined') ajaxCart.collapse(); }); $(function() { $('.count').each(function () { $(this).prop('Counter',0).animate({ Counter: $(this).text() }, { duration: 4000, easing: 'swing', step: function (now) { $(this).text(Math.ceil(now)); } }); }); }); $(function() { $('#testimonials').bxSlider({ responsive:true, useCSS: false, minSlides: 1, maxSlides: 1, slideWidth: 1200, slideMargin: 0, moveSlides: 1, pager: false, autoHover: false, speed: 500, pause: 3000, controls: true, autoControls: true, startText:'', stopText:'', prevText:'', nextText:'', }); }); $(document).ready(function(){ $("#back-to-top").css('visibility', 'visible'); $("#back-to-top").hide(); $(function () { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#back-to-top').fadeIn(); } else { $('#back-to-top').fadeOut(); } }); $('#back-to-top').click(function () { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); }); }); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now