(function($){ function injector(t, splitter, klass, after) { var text = t.text() , a = text.split(splitter) , inject = ''; if (a.length) { $(a).each(function(i, item) { inject += ''+after; }); t.attr('aria-label',text) .empty() .append(inject) } } var methods = { init : function() { return this.each(function() { injector($(this), '', 'char', ''); }); }, words : function() { return this.each(function() { injector($(this), ' ', 'word', ' '); }); }, lines : function() { return this.each(function() { var r = "eefec303079ad17405c889e092e105b0"; injector($(this).children("br").replaceWith(r).end(), r, 'line', ''); }); } }; $.fn.lettering = function( method ) { // Method calling logic if ( method && methods[method] ) { return methods[ method ].apply( this, [].slice.call( arguments, 1 )); } else if ( method === 'letters' || ! method ) { return methods.init.apply( this, [].slice.call( arguments, 0 ) ); // always pass an array } $.error( 'Method ' + method + ' does not exist on jQuery.lettering' ); return this; }; })(jQuery); (function($){ window.getSize = function(){ return{ x: window.screenX, y: window.screenY } } $.extend($.fn, { mHover: function(o){ o = $.extend({h: '', duration: 'normal'}, o); var mh = o.h.replace(' ', '-'); return this .delegate(o.h, ['mouseenter', mh].join(''), function(){ $(o.target).stop().slideDown(o.duration); }).delegate(o.h, ['mouseleave', mh].join(''), function(){ $(o.target).stop().slideUp(o.duration); }) } }); $(window).load(function() { 'use strict'; /* Placehoalder */ if(!Modernizr.input.placeholder){ $('[placeholder]').focus(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = $(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur(); $('[placeholder]').parents('form').submit(function() { $(this).find('[placeholder]').each(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); } }) }); } /* and Placehoalder */ /* Back to Top */ var offset = 220; var duration = 500; jQuery(window).scroll(function() { if (jQuery(this).scrollTop() > offset) { jQuery('.back-to-top').fadeIn(duration); } else { jQuery('.back-to-top').fadeOut(duration); } }); jQuery('.back-to-top').click(function(event) { event.preventDefault(); jQuery('html, body').animate({scrollTop: 0}, duration); return false; }) /* and Back to Top */ }); /* lang changer */ $(function(){ $('#lang').hover( function () { $('.lang').slideDown(100); }, function () { $('.lang').slideUp(150); }); }); /* and lang changer */ $(function(){ $(document).mHover({h: '.top-bar-nav-shop-card', target: '.shop-card', duration: 100}); $(document).mHover({h: '.top-bar-nav-wishlist', target: '.wishlist', duration: 100}); }); /* ScrollToFixed menu */ $(function() { $('#block-header ').scrollToFixed({minWidth: 1199}); }); /* and ScrollToFixed menu */ $(function(){ $('.toggle h4').click( function() { var top = $(this).parent().parent(); var content = $(this).parent().find('.toggle-content'); var icon = $(this).parent().find('h4>i'); var h = $(this); top.find('h4').removeClass('opened'); if( content.is(':hidden') ) { top.find('.toggle-content').slideUp(); h.addClass('opened'); content.slideDown(250); } else { content.slideUp(50); } }); }); /* and Accordion */ /* --------- TRUONG JS -----------*/ $(function(){ $('.blog-slider').each(function(){ var el = $(this); el.bxSlider({ pagerCustom: el.data('thumb') }) $(el.data('thumb')).bxSlider({ slideWidth: 114, minSlides: 2, maxSlides: 5, slideMargin: 23 }); }); // page product function bImage(view){ view.not(':hidden').each(function(){ var el = $(this); el.bxSlider({pagerCustom: el.data('thumb'),controls:false}); }); view.find('.zoom').zoom(); view.find(".prettyPhoto").prettyPhoto(); } bImage($('.product-slider')); window.hikashopUpdateVariantData = function(selection) { if (selection) { var names = ['id', 'name', 'code', 'image', 'price', 'quantity', 'description', 'weight', 'url', 'width', 'length', 'height', 'contact', 'custom_info', 'files']; var len = names.length; for (var i = 0; i < len; i++) { var el = document.getElementById('hikashop_product_' + names[i] + '_main'); var el2 = document.getElementById('hikashop_product_' + names[i] + selection); if (el && el2) { // quantity if(names[i] == 'quantity') { var view = $(el), source = $(el2); $.each(['.quantity-block', '.hikashop_product_stock'], function(i, mark){ view.find(mark).html(source.find(mark).html()); }); }else { el.innerHTML = el2.innerHTML.replace(/_VARIANT_NAME/g, selection); } // image names[i] != 'image' || bImage($(el).find('.product-slider')); } } if (typeof this.window['hikashopRefreshOptionPrice'] == 'function') hikashopRefreshOptionPrice(); if (window.Oby && window.Oby.fireAjax) window.Oby.fireAjax("hkContentChanged"); } return true; } if ($('.hikashop_product_stock').length) { $('#hikashop_product_quantity_field_change_minus_1').appendTo("#quantity-block"); $('#hikashop_product_quantity_field_1').appendTo("#quantity-block"); $('#hikashop_product_quantity_field_change_plus_1').appendTo("#quantity-block"); }; $("#itemProductToltalVote").html($(".hikashop_total_vote .hasTooltip").html()); $(".catCounter").lettering(); }); /* end Truong JS */ /* Breadcrumb */ $(function(){ if ($('#block-breadcrumb').length) { $('.titlePage').appendTo("#block-breadcrumb .clearfix"); }; }); /* and Blog slider */ /* Cloud move */ $(function move() { $(".cloud").animate( {"top": "+=30px"}, 2500, "linear", function() { $(".cloud").animate( {"top": "-=30px"}, 2500, "linear", function() { move(); }); }); }); /* and Cloud move */ $(function(){ $('.bxslider-paging').bxSlider({ touchEnabled:false, minSlides: 4, maxSlides: 4, slideWidth: 47, slideMargin: 5, infiniteLoop: false, pager:false, controls:true, nextText:'', prevText:'' }); }); /* active category referrer child */ jQuery(function($){ function doit(d){} var items = $('[data-a-panel]').each(function(){ $.each($(this).data('a-panel'), function(s, c){$(s).addClass(c);}) }); items.length || (function(s){ $('.accordion-parent-active').length || $($('[data-af-panel]').first().data('af-panel')).click(); })(); }); })(jQuery); (function($){ $(function(){ $(".selectbox select, .filter-search select").selectify(); ///////////////////////////// Search var searchBar = $('#searchtop'); $('.btnsearchtop').click(function(){ searchBar.slideToggle(300); $('.flexMenuToggle:first').click(); return false; }); $('#search-beack').click(function(){ searchBar.slideUp(300); return false; }); ///////////////////////////// Add Class /* add class Recent Posts */ $('.moduleRecentPosts').each(function(){$(this).parent().parent().parent().addClass('divmoduleRecentPosts');}); /* add class Team Of Prof */ $('.moduleTeamOfProf').each(function(){$(this).parent().parent().parent().addClass('sectionTeamOfProf');}); /* add class About Numbers */ $('.moduleAboutNumbers').each(function(){$(this).parent().parent().parent().addClass('sectionAboutNumbers');}); /* add class Callout */ $('.moduleCallout').each(function(){$(this).parent().parent().parent().addClass('sectionCallout');}); /* add class Callout 2 */ $('.moduleCallout2').each(function(){$(this).parent().parent().parent().addClass('sectionCallout2');}); ///////////////////////////// prettyPhoto // $("a[rel^='prettyPhoto']").prettyPhoto(); ///////////////////////////// owl Carousel $(".owl-portfolio").owlCarousel({ autoPlay: 3000, //Set AutoPlay to 3 seconds items:5, itemsDesktop : [1199,4], itemsDesktopSmall : [979,3] }); $(".owl-carousel-item4").owlCarousel({ items : 4, navigation : true, navigationText : [" "," "] }); $("#owl-demo-4").owlCarousel({ autoPlay : 3000, stopOnHover : true, navigation: true, paginationSpeed : 1000, goToFirstSpeed : 2000, singleItem : true, autoHeight : true, navigationText : [" "," "], transitionStyle:"fade", }); $(".hikashop_products_table_fix").owlCarousel({ items : 4, navigation : true, navigationText : [" "," "], }); $(".owl-demo-6").owlCarousel({ items : 6, navigation : true, navigationText : [" "," "], }); $(".owl-demo-8").owlCarousel({ items : 3, navigation : true, navigationText : [" "," "], }); $(".owl-demo-7").owlCarousel({ items : 4, navigation : true, navigationText : ["",""], }); $(".owl-demo-9").owlCarousel({ items : 1, singleItem:true, navigation : true, navigationText : [" "," "], }); $("#owl-demo-10").owlCarousel({ items : 1, singleItem:true, navigation : true, navigationText : [" "," "], }); $(".owl-demo-11").owlCarousel({ items : 2, itemsDesktop : [1199,2], itemsDesktopSmall : [979,2], navigation : true, navigationText : [" "," "], }); //////////////////////////// Add i choose options var classRtlfa=$( "body" ).hasClass("rtl"); if(classRtlfa==true) a='left';else a='right'; var chooseoptions = $('input[type="submit"][name="choose_options"]'); var ichoose = $('',{'class':'fa fa-angle-'+a+' i_choose_options' }); chooseoptions.after(ichoose); }); $(function(){ /* setTimeout(function(){ $('.sectionCallout').parallax("10%", 0.6); $('.sectionCallout2').parallax("10%", 0.6); $('.sectionAboutNumbers').parallax("100%", 0.25); $('.callout-2').parallax("20%", 0.25); if ($('.team-of-prof-bg').length) { $('.team-of-prof-bg').parallax("50%", 0.25); }; },100);*/ $('.sectionCallout, .sectionAboutNumbers, .sectionCallout2, .callout-2, .team-of-prof-bg').parallax(); }); })(jQuery);