Advertisement
towfiqi

optimizer.js

May 16th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.04 KB | None | 0 0
  1. /**
  2. * The Javascript file for Optimizer
  3. *
  4. * Stores all the javascript of the template.
  5. *
  6. * @package LayerFramework
  7. *
  8. * @since LayerFramework 1.0
  9. */
  10.  
  11. jQuery(window).ready(function() {
  12. //MENU Animation
  13. if (jQuery(window).width() > 768) {
  14.  
  15. jQuery('#topmenu ul > li').not('#topmenu ul > li.mega-menu-item').hoverIntent(function(){
  16. jQuery(this).find('.sub-menu, ul.children').eq(0).removeClass('animated fadeOut').addClass('animated fadeInUp menushow');
  17. }, function(){
  18. jQuery(this).find('.sub-menu, ul.children').eq(0).addClass('animated fadeOut').delay(300).queue(function(next){ jQuery(this).removeClass("animated fadeInUp menushow");next();});
  19. });
  20.  
  21. jQuery('#topmenu ul li ul li').not('#topmenu ul li.mega-menu-item ul.mega-sub-menu li').hoverIntent(function(){
  22. jQuery(this).find('.sub-menu, ul.children').eq(0).removeClass('animated fadeOut').addClass('animated fadeInUp menushow');
  23. }, function(){
  24. jQuery(this).find('.sub-menu, ul.children').eq(0).addClass('animated fadeOut').delay(300).queue(function(next){
  25. jQuery(this).removeClass("animated fadeInUp menushow");next();});
  26. });
  27.  
  28. jQuery('#topmenu ul li').not('#topmenu ul li.mega-menu-item, #topmenu ul li ul li').hover(function(){
  29. jQuery(this).addClass('menu_hover');
  30. }, function(){
  31. jQuery(this).removeClass('menu_hover');
  32. });
  33. jQuery('#topmenu li').has("ul").addClass('zn_parent_menu');
  34. jQuery('.zn_parent_menu > a').append('<span class="menu_arrow"><i class="fa-angle-down"></i></span>');
  35.  
  36. }
  37.  
  38. //TOPMENU ICON STYLE
  39. jQuery('.menu_style_5 ul>li a').each(function() {
  40. jQuery(this).attr('title', jQuery(this).find('.menu_icon').attr('title'))
  41. jQuery(this).miniTip({content: jQuery(this).attr('title')});
  42. jQuery(this).find('.menu_icon').attr('title', '');
  43. });
  44.  
  45. //Slider CTA Buttons Scroll function
  46. jQuery('.cta_buttons a[href^="#"]').each(function() {
  47. var scrollidraw = jQuery(this).attr('href');
  48. var scrollid = scrollidraw.substr(0, scrollidraw.indexOf('='));
  49. var scrollname = scrollidraw.substr(scrollidraw.indexOf("=") + 1);
  50. jQuery(this).attr('href', '#'+scrollname);
  51. jQuery(this).click(function() {
  52. //e.preventDefault();
  53. jQuery(this).attr('data-scrollid', scrollid);
  54. jQuery('html, body').animate({scrollTop: jQuery(scrollid).offset().top -100}, 'slow')
  55. });
  56. });
  57.  
  58. //NEW TOPMENU Onepage Scroll function
  59. jQuery('#topmenu ul>li[class^="optimizer_front_"], #topbar_menu ul>li[class^="optimizer_front_"], #topmenu ul>li[class^="ast_"]').each(function(){
  60. var getClass = jQuery.grep(this.className.split(" "), function(v, i){if( v.indexOf('optimizer_front_') === 0){ return v.indexOf('optimizer_front_') ===0; }else{ return v.indexOf('ast_') ===0; } }).join();
  61.  
  62. if(jQuery('#'+getClass).length){
  63. jQuery('#topmenu ul .'+getClass+' a, #topbar_menu ul .'+getClass+' a').click(function(e) {e.preventDefault(); jQuery('html, body').animate({scrollTop: jQuery('#'+getClass).offset().top -100}, 'slow'); });
  64.  
  65. var menucount = jQuery('#topmenu ul>li').length;
  66. var onemenucount = jQuery('#topmenu ul>li[class^="optimizer_front_"]').length;
  67. if(menucount == onemenucount){jQuery('body').addClass('optimizer_onepager');}
  68.  
  69. if(menucount == onemenucount){
  70. var inview = new Waypoint.Inview({
  71. element: jQuery('#'+getClass)[0],
  72. enter: function(direction) {
  73. jQuery('.header ul li').removeClass('current-menu-item onepagemenu_highlight');
  74. jQuery('.header ul li.'+getClass).addClass('current-menu-item onepagemenu_highlight');
  75. },
  76. });
  77. jQuery(window).bind("scroll", function() {
  78. if (jQuery(this).scrollTop() < 300) {
  79. jQuery('.header ul li').removeClass('current-menu-item onepagemenu_highlight');
  80. }
  81. });
  82. }else{
  83. var inview = new Waypoint.Inview({
  84. element: jQuery('#'+getClass)[0],
  85. enter: function(direction) { jQuery('.header ul li.'+getClass).addClass('current-menu-item onepagemenu_highlight'); },
  86. exited: function(direction) { jQuery('.header ul li.'+getClass).removeClass('current-menu-item onepagemenu_highlight'); }
  87. });
  88.  
  89. }
  90. }
  91. });
  92. //Scroll to the specific widget when clicked from other pages
  93. jQuery(window).bind("load", function() {
  94. if(window.location.hash) {
  95. var currenturl = window.location.href;
  96.  
  97. jQuery('#topmenu a[href="'+currenturl+'"], #topbar_menu a[href="'+currenturl+'"]').each(function(){
  98.  
  99. var matchedmenu = jQuery(this).parent();
  100. var getClass = jQuery.grep(matchedmenu.attr('class').split(" "), function(v, i){if( v.indexOf('optimizer_front_') === 0){ return v.indexOf('optimizer_front_') ===0; }else{ return v.indexOf('ast_') ===0; } }).join();
  101.  
  102. if(jQuery('#'+getClass).length){
  103. jQuery('html, body').animate({scrollTop: jQuery('#'+getClass).offset().top -100}, 'slow');
  104. }
  105. });
  106.  
  107. }
  108. });
  109.  
  110.  
  111. //Load Logo in Middle
  112. if(jQuery('.logo_middle #topmenu .menu-header').length !==0){ var menunum = jQuery('.logo_middle #topmenu ul.menu>li').not('li.menu-item.menu-item-language').length;}else{ var menunum = jQuery('.logo_middle #topmenu .menu ul>li').length;}
  113. var logopos = Math.round(menunum/2);
  114. jQuery('.logo_middle #topmenu ul.menu > li:nth-child('+logopos+'), .logo_middle #topmenu .menu>ul>li:nth-child('+logopos+')').after('<div class="logo">'+jQuery('.logo_middle .logo').html()+'</div>');
  115. jQuery('.logo_middle, .logo_middle #topmenu .logo').animate({"opacity": "1"});
  116.  
  117.  
  118. //CENTER MENU ITEMS VERTICALLY FOR MENU STYLE2
  119. jQuery('.logo_middle #topmenu').waitForImages(function() {
  120. jQuery('.logo_middle #topmenu .menu-item, #topmenu .head_soc').not('.logo_middle #topmenu .menu-item .menu-item').css({ "bottom":(jQuery(".logo_middle #topmenu").height() / 2) /2});
  121. });
  122.  
  123. //Slider empty content
  124. jQuery('.acord_text p:empty, .acord_text h3 a:empty, .nivoinner h3 a:empty').css({"display":"none"});
  125.  
  126.  
  127. //Equal height - BLOCKS
  128. jQuery('.midrow_blocks_wrap').each(function(index, element) {
  129. jQuery(this).waitForImages(function() {
  130. jQuery(this).find('.midrow_block').matchHeight({ property: 'min-height', byRow: 'height'});
  131. });
  132. });
  133.  
  134.  
  135. //Layout1 Animation
  136. jQuery(".lay1").each(function(index, element) {
  137. var divs = jQuery(this).find(".hentry");
  138. for(var i = 0; i < divs.length; i+=3) {
  139. divs.slice(i, i+3).wrapAll("<div class='ast_row'></div>");
  140. }
  141. if (jQuery(window).width() < 1200) {
  142. var flaywidth = jQuery(this).find(".hentry").width();
  143. jQuery(this).find('.post_image').css({"maxHeight":(flaywidth * 66)/100});
  144. }
  145. });
  146.  
  147. jQuery('.lay1 .postitle a:empty').closest("h2").addClass('no_title');
  148. jQuery('.no_title').css({"padding":"0"});
  149.  
  150. jQuery('.lay1 h2.postitle a').each(function() {
  151. if(jQuery(this).height() >80){ jQuery(this).parent().parent().parent().addClass('lowreadmo'); }
  152. });
  153. jQuery('.lts_layout1 .listing-item h2').each(function() {
  154. if(jQuery(this).outerHeight() >76){ jQuery(this).parent().addClass('lowreadmo'); }
  155. });
  156.  
  157. // TO_TOP
  158. jQuery(window).bind("scroll", function() {
  159. if (jQuery(this).scrollTop() > 800) {
  160. jQuery(".to_top").fadeIn('slow');
  161. } else {
  162. jQuery(".to_top").fadeOut('fast');
  163. }
  164. });
  165. jQuery(".to_top").click(function() {
  166. jQuery("html, body").animate({ scrollTop: 0 }, "slow");
  167. return false;
  168. });
  169.  
  170.  
  171. //Divider icon style
  172. jQuery('.div_middle i.fa-minus').after('<i class="fa fa-minus"></i><i class="fa fa-minus"></i>');
  173. jQuery('.homeposts_title.title_border-center, .homeposts_title.title_border-left, .homeposts_title.title_border-right, .about_inner.title_border-center, .about_inner.title_border-left, .about_inner.title_border-right').each(function(index, element) {
  174. var wtitle = jQuery(this).find('.home_title span, .block_header span, .about_header span');
  175. var wstitle = jQuery(this).find('.home_subtitle');
  176. if(wtitle.width() > wstitle.width()){ jQuery(this).find('.div_left, .div_right').css({"width":"calc(47% - "+wtitle.width() / 2+"px)"}); }
  177. if(wtitle.width() < wstitle.width()){ jQuery(this).find('.div_left, .div_right').css({"width":"calc(47% - "+wstitle.width() / 2+"px)"}); }
  178. if(jQuery(this).find('.home_title span, .block_header span').length == 0 && jQuery(this).find('.home_subtitle').length == 0){ jQuery(this).addClass('widget_notitle'); }
  179. });
  180.  
  181. //STICKY SINGLE SHARE LEFT ICONS
  182. jQuery(".share_pos_left").stick_in_parent();
  183. //Share Buttons move after:
  184. jQuery('.share_foot.share_pos_after').appendTo(".single_post_content");
  185.  
  186. //STATIC SLIDER IMAGE FIXED
  187. jQuery('.stat_has_img').waitForImages(function() {
  188. var statimg = jQuery(".stat_has_img .stat_bg_img").attr('src');
  189. var body_size = jQuery('.stat_has_img .stat_content_inner .center').height() + 120;
  190. var statimgheight = jQuery(".stat_has_img .stat_bg_img").height() + jQuery(".header").height();
  191. if(body_size > statimgheight){var statimgheight = body_size + jQuery(".header").height();}
  192. var hheight = jQuery(".header").height();
  193. jQuery("body.home").prepend('<div class="stat_bg" style="height:'+statimgheight+'px"><img src="'+statimg+'" /></div><div class="stat_bg_overlay overlay_off" style="height:'+statimgheight+'px" />');
  194. jQuery('#slidera').css({"minHeight":"initial"});
  195. jQuery('.home .stat_has_img .stat_bg_img').css('opacity', 0);
  196.  
  197. //Static Slider Overlay on scroll
  198. overlayon = jQuery(".home .stat_has_img");
  199. overlayon.waypoint({ handler: function(direction) { jQuery('.home .stat_bg_overlay').removeClass("overlay_off").addClass("overlay_on"); }, offset: '-170px' });
  200.  
  201. overlayoff = jQuery(".home .stat_has_img");
  202. overlayoff.waypoint({ handler: function(direction) { jQuery('.home .stat_bg_overlay').removeClass("overlay_on").addClass("overlay_off");; }, offset: '-90px' });
  203.  
  204.  
  205. });
  206.  
  207.  
  208. jQuery('.stat_has_img').waitForImages(function() {
  209. if (jQuery(window).width() > 480) {
  210. var resizeTimer;
  211. jQuery(window).bind("load resize", function() {
  212. clearTimeout(resizeTimer);
  213. resizeTimer = setTimeout(function() {
  214. var body_size = jQuery('.stat_has_img .stat_content_inner .center').height() + 120;
  215. jQuery('#stat_img, .stat_bg, .stat_bg img, .stat_bg_overlay').css('min-height',body_size);
  216. }, 50);
  217. });
  218. }
  219. var slidercontent_pos = jQuery('.stat_content_inner').position();
  220. if (slidercontent_pos.top < 0) {jQuery('.stat_content_inner').css({"bottom":"10%"})}
  221. });
  222.  
  223.  
  224.  
  225. jQuery(window).bind("load resize", function() {
  226. if (jQuery(window).width() <= 480) {
  227. jQuery(".stat_bg_img").css({"opacity":"0"});
  228. jQuery('.stat_content_inner').waitForImages(function() { jQuery("#stat_img").height(jQuery(".stat_content_inner").height()); });
  229. var statbg = jQuery(".stat_bg_img").attr('src');
  230. jQuery(".stat_has_img").css({"background":"url("+statbg+")", "background-repeat":"no-repeat", "background-size":"cover"});
  231. jQuery('.has_sticky_header .header').waitForImages(function() {
  232.  
  233. });
  234. }
  235. if (jQuery(window).width() > 480) {
  236. var statbg = jQuery(".stat_bg_img").attr('src');
  237. jQuery(".stat_has_img").css({"background":"url("+statbg+") top center", "background-repeat":"no-repeat", "background-size":"cover"});
  238. jQuery('.has_trans_header .stat_content_inner, .has_trans_header .header').waitForImages(function() {
  239. var mhheight = jQuery(".has_trans_header .header").height();
  240. jQuery(".has_trans_header .stat_content_inner").css({"paddingTop":mhheight});
  241.  
  242. });
  243. jQuery('.page_header_transparent .has_header_img .pagetitle_wrap').css({"top":jQuery(".page_header_transparent .header").height()})
  244. }
  245. });
  246. //WAYPOINT ANIMATIONS
  247. if (jQuery(window).width() > 480) {
  248.  
  249. jQuery('.home #zn_nivo, .home #accordion').waitForImages(function() {
  250. //Header color on scroll
  251. var sliderheight = jQuery('.home #zn_nivo, .home #accordion').height();
  252.  
  253. stickyheadwaypoint = jQuery(".home #zn_nivo, .home #accordion");
  254. stickyheadwaypoint.waypoint({ handler: function(direction) { jQuery(".is-sticky .header").addClass("headcolor"); }, offset: '-'+sliderheight/2+'px' });
  255. stickyheadwaypoint.waypoint({ handler: function(direction) { jQuery(".is-sticky .header").removeClass("headcolor"); }, offset: '-90px' });
  256.  
  257. });
  258.  
  259. //BLOCKS Animation
  260. blockswaypoint = jQuery(".midrow_blocks .midrow_bloc");
  261. blockswaypoint.css({"opacity":"0"});
  262. blockswaypoint.waypoint({ handler: function(direction) { blockswaypoint.addClass('animated bounceIn'); }, offset: '90%' });
  263.  
  264.  
  265. //WELCOME Animation
  266. textwaypoint = jQuery(".welcmblock .text_block_wrap");
  267. textwaypoint.css({"opacity":"0"});
  268. textwaypoint.waypoint({ handler: function(direction) { textwaypoint.addClass('animated fadeIn'); }, offset: '90%' });
  269.  
  270. //Posts Animation
  271. postswaypoint = jQuery(".home .postsblck .center");
  272. postswaypoint.css({"opacity":"0"});
  273. postswaypoint.waypoint({ handler: function(direction) { postswaypoint.addClass('animated fadeInUp'); }, offset: '85%' });
  274.  
  275. //Call to Action
  276. ctawaypoint = jQuery(".home_action_left, .home_action_right");
  277. ctawaypoint.waypoint({ handler: function(direction) { ctawaypoint.addClass('animated fadeIn'); }, offset: '100%' });
  278.  
  279. //Testimonial
  280. testiwaypoint = jQuery(".home_testi .center");
  281. testiwaypoint.css({"opacity":"0"});
  282. testiwaypoint.waypoint({ handler: function(direction) { testiwaypoint.addClass('animated fadeIn'); }, offset: '95%' });
  283.  
  284. //Footer Widgets
  285. footerwaypoint = jQuery(".home #footer .widgets");
  286. footerwaypoint.css({"opacity":"0"});
  287. footerwaypoint.waypoint({ handler: function(direction) { footerwaypoint.addClass('animated fadeInUp'); }, offset: '90%' });
  288.  
  289. //MAP
  290. mapwaypoint = jQuery(".ast_map");
  291. mapwaypoint.waypoint({ handler: function(direction) { mapwaypoint.addClass('animated fadeIn'); }, offset: '95%' });
  292.  
  293. //Clients
  294. clientswaypoint = jQuery(".client_logoimg");
  295. clientswaypoint.css({"opacity":"0"});
  296. clientswaypoint.waypoint({ handler: function(direction) { clientswaypoint.addClass('animated fadeInUp'); }, offset: '95%' });
  297.  
  298. }
  299.  
  300. //Next Previous post button Link
  301. var link = jQuery('.ast-next > a').attr('href');
  302. jQuery('.right_arro').attr('href', link);
  303.  
  304. var link = jQuery('.ast-prev > a').attr('href');
  305. jQuery('.left_arro').attr('href', link);
  306.  
  307. //Gallery Template
  308. jQuery("#sidebar .widget_pages ul li a, #sidebar .widget_meta ul li a, #sidebar .widget_nav_menu ul li a, #sidebar .widget_categories ul li a, #sidebar .widget_recent_entries ul li a, #sidebar .widget_recent_comments ul li, #sidebar .widget_archive ul li, #sidebar .widget_rss ul li").prepend('<i class="fa-double-angle-right"></i> ');
  309. jQuery('#sidebar .fa-double-angle-right').css({"opacity":"0.5"})
  310.  
  311.  
  312.  
  313. //Mobile Menu
  314. var padmenu = jQuery("#simple-menu").html();
  315.  
  316. jQuery('#simple-menu').sidr({name: 'sidr-main', source: '#topmenu', side: 'right'});
  317.  
  318. //Make Icons show up in sidr
  319. jQuery('.sidr-class-menu-item i').attr('class', function(_, klass) {
  320. return 'fa fa' + klass.split('-fa').pop();
  321. });
  322.  
  323. jQuery("#topmenu .head_soc").clone().appendTo(".sidr-class-head_soc");
  324.  
  325. //Topbar Hamburger Menu
  326. var topadmenu = jQuery("#topbar-hamburger-menu").html();
  327. jQuery('#topbar-hamburger-menu').sidr({ name: 'sidr-topbar', source: '#topbar_menu', side: 'right'});
  328. jQuery(".sidr").prepend("<div class='pad_menutitle'><i class='fa fa-bars'></i><span><i class='fa-times'></i></span></div>");
  329.  
  330. jQuery(".pad_menutitle span").click(function() {
  331. jQuery.sidr('close', 'sidr-main');
  332. jQuery.sidr('close', 'sidr-topbar');
  333. preventDefaultEvents: false;
  334. });
  335.  
  336. //Hamburger Compatibility
  337. jQuery('.sidr-class-menu li[class^="sidr-class-optimizer_front_"]').each(function(){
  338. var getClassraw = jQuery.grep(this.className.split(" "), function(v, i){return v.indexOf('sidr-class-optimizer_front_') === 0; }).join();
  339. var getClass = getClassraw.replace("sidr-class-", "");
  340. if(jQuery('#'+getClass).length){
  341. jQuery('.sidr-class-menu .'+getClassraw+' a').click(function(e) {e.preventDefault(); jQuery('html, body').animate({scrollTop: jQuery('#'+getClass).offset().top -100}, 'slow'); });
  342. }
  343. });
  344.  
  345. //If the topmenu is empty remove it
  346. if (jQuery(window).width() < 1025) {
  347. if(jQuery("#topmenu:has(ul)").length == 0){
  348. jQuery('#simple-menu, #dropdown-menu').addClass('hide_mob_menu');
  349. }
  350. }
  351.  
  352. //Dropdown Mobile Menu
  353. jQuery("#dropdown-menu").toggle(function(e) {
  354. jQuery('#topmenu.mobile_dropdown').css("top", jQuery('.head_inner').outerHeight()).slideDown(300);
  355. jQuery("#dropdown-menu i.fa-chevron-down").removeClass('fa-chevron-down').addClass('fa-chevron-up');
  356. }, function(){
  357. jQuery('#topmenu.mobile_dropdown').slideUp(300);
  358. jQuery("#dropdown-menu i.fa-chevron-up").removeClass('fa-chevron-up').addClass('fa-chevron-down');
  359. });
  360.  
  361.  
  362. //NivoSlider Navigation Bug Fix
  363. if (jQuery(window).width() < 480) {
  364. jQuery(".nivo-control").text('');
  365. }
  366.  
  367. //slider porgressbar loader
  368. jQuery('.slider-wrapper').waitForImages(function() {
  369. jQuery("#zn_nivo, .nivo-controlNav, #slide_acord, .nivoinner").css({"display":"block"});
  370. jQuery(".pbar_wrap, .pbar_overlay").fadeOut();
  371. jQuery('.slider-wrapper').css({"minHeight":"initial"});
  372. });
  373.  
  374. //TESTIMONIAL SLIDE
  375. jQuery('.home_testi .looper').on('shown', function(e){
  376. jQuery('.looper-nav > li', this).removeClass('active').eq(e.relatedIndex).addClass('active');
  377. });
  378.  
  379.  
  380. //HEADER SWITCH
  381. jQuery('#slidera').has('.stat_has_img').addClass('selected_stat');
  382. jQuery('#slidera').has('.slide_wrap').addClass('selected_slide');
  383.  
  384.  
  385.  
  386. if (jQuery(window).width() < 1025) {
  387. jQuery('.dlthref').removeAttr("href");
  388. }
  389.  
  390.  
  391. //WIDGET BORDER
  392. jQuery("#sidebar .widget .widgettitle, .related_h3, h3#comments, #reply-title").after("<span class='widget_border' />");
  393.  
  394. //Rearragnge comment form box
  395. jQuery(".comm_wrap").insertAfter(".comment-form-comment");
  396. jQuery(".comm_wrap input").placeholder();
  397.  
  398. //404 class is not being added in body
  399. jQuery('body').has('.error_msg').addClass('error404');
  400.  
  401. //TOP Header Search
  402. jQuery('.head_search i').toggle(function(){
  403. jQuery('.head_search form').css({"width":"170px"});
  404. },function(){
  405. jQuery('.head_search form').css({"width":"0px"});
  406. });
  407.  
  408. //MAILCHIMP
  409. jQuery('.mc-field-group').each(function() {
  410. var placeholder = jQuery(this).find('label').text();
  411. jQuery(this).find('input').attr('placeholder', ''+placeholder+'')
  412. });
  413. //Subscribe2
  414. jQuery('.ast_subs_form').has("#s2email").addClass('ast_subscribe2');
  415.  
  416.  
  417.  
  418. //Center Call to Action Button
  419. jQuery('.cta_button_right .home_action_right').flexVerticalCenter({ cssAttribute: 'padding-top', parentSelector: '.cta_button_right' });
  420. jQuery('.cta_button_left .home_action_right').flexVerticalCenter({ cssAttribute: 'padding-top', parentSelector: '.cta_button_left' });
  421.  
  422. //Next-Previous Post Image Check
  423. jQuery(".nav-box.ast-prev, .nav-box.ast-next").not(":has(img)").addClass('navbox-noimg');
  424.  
  425.  
  426. //Make sure the footer always stays to the bottom of the page when the page is short
  427. jQuery(window).bind("load", function() {
  428. var docHeight = jQuery(window).height();
  429. var footerHeight = jQuery('#footer').height();
  430. var footerTop = jQuery('#footer').position().top + footerHeight;
  431.  
  432. if (footerTop < docHeight) { jQuery('#footer').css('margin-top', 1 + (docHeight - footerTop) + 'px'); }
  433.  
  434. /*Widget Parallax*/
  435. /* if (jQuery(window).width() >= 480) {
  436. jQuery('.parallax_img').each(function(index, element) {
  437. jQuery(this).parallax({naturalHeight: jQuery(this).parent().outerHeight(), bleed: 50, iosFix: true, androidFix: true}).css({"backgroundImage":"none"});
  438. });
  439. }*/
  440. });
  441.  
  442. //Woocommerce
  443. jQuery('.lay1.optimposts, .lay2.optimposts, .lay4.optimposts').each(function(index, element) { jQuery(this).waitForImages(function() { jQuery(this).find('.type-product').matchHeight({property: 'min-height'}); }); });
  444. jQuery('.lay1.optimposts .type-product').each(function(index, element) {
  445. if (jQuery(window).width() >= 960) { jQuery(this).find('.button.add_to_cart_button').prependTo(jQuery(this).find('.imgwrap')); }
  446. jQuery(this).find('span.price').prependTo(jQuery(this).find('.post_image '));
  447. });
  448.  
  449. //MENU WIDGET & TOPBAR MENU DROPDOWN
  450. jQuery('#frontsidebar .widget_nav_menu ul.menu li, #topbar_menu ul li').not('#topbar_menu ul > li.mega-menu-item').hoverIntent( function(){
  451. jQuery(this).find('ul:first').fadeIn();
  452. }, function(){
  453. jQuery(this).find('ul:first').fadeOut();
  454. });
  455.  
  456. //Hide the Next Previous Post area when empty
  457. if( !jQuery('body.single #ast_nextprev .ast-prev').length && !jQuery('body.single #ast_nextprev .ast-next').length){jQuery('body.single #ast_nextprev').hide()}
  458.  
  459. //Portfolio Share Buttons
  460. jQuery('.portfolio_wrapper .social_buttons').append('<div class="lgn_more"><i class="fa fa-ellipsis-h"></i></div>');
  461. jQuery('.portfolio_wrapper .social_buttons .lgn_stmbl, .portfolio_wrapper .social_buttons .lgn_del, .portfolio_wrapper .social_buttons .lgn_digg, .portfolio_wrapper .social_buttons .lgn_email, .portfolio_wrapper .social_buttons .lgn_print').wrapAll('<div class="social_more" />');
  462. jQuery('.portfolio_wrapper .lgn_more').toggle(function(e) {
  463. jQuery('.portfolio_wrapper .social_more').addClass('social_more_show');
  464. }, function(){
  465. jQuery('.portfolio_wrapper .social_more').removeClass('social_more_show');
  466. });
  467.  
  468. //IF iOS, Hide the video slider:
  469. if(getMobileOperatingSystem() == 'iOS'){
  470. jQuery('body').addClass('is-ios');
  471. }else{
  472. jQuery('body').addClass('not-ios');
  473. }
  474. //Check If Safari
  475. if(isSafari == true){
  476. jQuery('body').addClass('is_safari');
  477. }
  478.  
  479. //Newsletter--------------
  480. jQuery('.optim_newsletter_form .mimi_field').each(function(index, element) { jQuery(this).find('br').remove(); });
  481. jQuery('.optim_newsletter_form label').each(function(index, element) {
  482. if(jQuery(this).next().is('input')){
  483. jQuery(this).addClass('placeholder_label');
  484. }
  485. });
  486.  
  487. jQuery('.optim_newsletter_form input[type="text"], .optim_newsletter_form input[type="email"], .optim_newsletter_form input[type="phone"]').each(function(index, element) {
  488. if(jQuery(this).prev().is('label') ){
  489. var attr = jQuery(this).attr('placeholder');
  490. if (typeof attr == typeof undefined || attr == false) {
  491. jQuery(this).attr('placeholder', jQuery(this).prev().text());
  492. }
  493. }
  494. });
  495.  
  496.  
  497. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement