Advertisement
towfiqi

asteria.js

May 22nd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.64 KB | None | 0 0
  1. // JavaScript Document
  2. jQuery(window).ready(function() {
  3.  
  4. //MENU Animation
  5. if (jQuery(window).width() > 768) {
  6. jQuery('#topmenu ul > li').hoverIntent(function(){
  7. jQuery(this).find('.sub-menu:first, ul.children:first').slideDown({ duration: 200});
  8. }, function(){
  9. jQuery(this).find('.sub-menu:first, ul.children:first').slideUp({ duration: 200});
  10.  
  11. });
  12.  
  13. jQuery('#topmenu ul li').not('#topmenu ul li ul li').hover(function(){
  14. jQuery(this).addClass('menu_hover');
  15. }, function(){
  16. jQuery(this).removeClass('menu_hover');
  17. });
  18. jQuery('#topmenu li').has("ul").addClass('zn_parent_menu');
  19. jQuery('.zn_parent_menu > a').append('<span><i class="fa-angle-down"></i></span>');
  20. }
  21.  
  22. //Slider Navigation Animation
  23. jQuery('#zn_nivo').hover(function(){
  24. jQuery(this).find('.nivo-directionNav').stop().animate({ "opacity":"1" }, 300);
  25. }, function(){
  26. jQuery(this).find('.nivo-directionNav').stop().animate({ "opacity":"0" }, 300);
  27. });
  28.  
  29. //Slider empty content
  30. jQuery('.acord_text p:empty, .acord_text h3 a:empty, .uninner h3 a:empty, .nivoinner h3 a:empty').css({"display":"none"});
  31.  
  32. //Widget image opacity animation
  33. jQuery('.widget_wrap a img').hover(function(){
  34. jQuery(this).stop().animate({ "opacity":"0.7" }, 300);
  35. }, function(){
  36. jQuery(this).stop().animate({ "opacity":"1" }, 300);
  37. });
  38.  
  39.  
  40. //Layout1 Animation
  41. if (jQuery(window).width() < 360) {
  42. var divs = jQuery(".lay1 .hentry");
  43. for(var i = 0; i < divs.length; i+=1) {
  44. divs.slice(i, i+1).wrapAll("<div class='ast_row'></div>");
  45. }
  46. }else if (jQuery(window).width() < 480) {
  47. var divs = jQuery(".lay1 .hentry");
  48. for(var i = 0; i < divs.length; i+=2) {
  49. divs.slice(i, i+2).wrapAll("<div class='ast_row'></div>");
  50. }
  51. }else{
  52. var divs = jQuery(".lay1 .hentry");
  53. for(var i = 0; i < divs.length; i+=3) {
  54. divs.slice(i, i+3).wrapAll("<div class='ast_row'></div>");
  55. }
  56. }
  57.  
  58. jQuery('.lay1 .postitle a:empty').closest("h2").addClass('no_title');
  59. jQuery('.no_title').css({"padding":"0"});
  60.  
  61.  
  62. //Pagination
  63. if ( jQuery('.ast_pagenav').children().length < 7 ) {
  64. jQuery('.ast_pagenav .page-numbers:last-child').css({'marginRight':'0'});
  65. jQuery('.ast_pagenav .page-numbers').wrapAll('<div class="pagi_border" />');
  66. jQuery('.pagi_border').append('<dt />');
  67. var sum=0;
  68. jQuery('.ast_pagenav .page-numbers').each( function(){ sum += jQuery(this).outerWidth( true ); });
  69. jQuery('.ast_pagenav .pagi_border').width( sum );
  70. }
  71.  
  72. //Call to Action
  73. jQuery('.home_action_left').each(function (){
  74. var callheight = jQuery(this) .height();
  75. jQuery('.home_action_right') .css({'height': callheight});
  76. });
  77.  
  78.  
  79. //Related Tabs
  80. if (jQuery('#ast_related:has(*)').length) {
  81. jQuery('#ast_related').easytabs({transitionIn: 'fadeIn', transitionOut: 'fadeOut', transitionInEasing : 'linear'});
  82. }else{
  83. jQuery('#ast_related_wrap').remove();
  84. }
  85.  
  86.  
  87. // TO_TOP
  88. jQuery(window).bind("scroll", function() {
  89. if (jQuery(this).scrollTop() > 800) {
  90. jQuery(".to_top").fadeIn('slow');
  91. } else {
  92. jQuery(".to_top").fadeOut('fast');
  93. }
  94. });
  95. jQuery(".to_top").click(function() {
  96. jQuery("html, body").animate({ scrollTop: 0 }, "slow");
  97. return false;
  98. });
  99.  
  100.  
  101. //Sidebar widget padding fix
  102. jQuery('.widget').not(':has(.widgettitle)').addClass('untitled');
  103. jQuery('.rel_eq').equalHeights();
  104.  
  105. //Hide Homepage Elemnts if empty
  106. jQuery('.home_blocks').each(function () {
  107. if(jQuery(this).html().length > 3) {
  108. jQuery(this).addClass('activeblock');
  109. }
  110. });
  111.  
  112.  
  113. jQuery('.lay1, .lay2, .lay3, .lay4, .lay5, .lay6').not(':has(.hentry)').css({"display":"none"});
  114.  
  115.  
  116. //WAYPOINT ANIMATIONS
  117. if (jQuery(window).width() > 480) {
  118.  
  119. jQuery('.midrow_block').css({"opacity":"0"})
  120. jQuery('.midrow_block').waypoint(function() {
  121. jQuery(this).addClass('animated fadeInUp');
  122. }, { offset: '90%' });
  123.  
  124. //Posts Animation
  125. jQuery('.home .lay1 .lay1_wrap').css({"opacity":"0"});
  126. jQuery('.home .lay1').waypoint(function() {
  127. jQuery('.home .homeposts_title, .home .lay1_wrap').addClass('animated fadeInUp');
  128. }, { offset: '90%' });
  129.  
  130. //Call to Action
  131. jQuery('.home_action').css({"opacity":"0"})
  132. jQuery('.home_action').waypoint(function() {
  133. jQuery(this).animate({"opacity":"1"});}, { offset: '90%' });
  134.  
  135. //Home Widgets Animation
  136. jQuery('#home_widgets .widget:eq(0) , #home_widgets .widget:eq(1) , #home_widgets .widget:eq(2)').css({"opacity":"0","marginTop":"60px"})
  137. jQuery('#home_widgets').waypoint(function() {
  138. jQuery('#home_widgets .widget:eq(0)').animate({"opacity":"1", "marginTop":"0px"});
  139. jQuery('#home_widgets .widget:eq(1)').delay(150).animate({"opacity":"1", "marginTop":"0px"});
  140. jQuery('#home_widgets .widget:eq(2)').delay(300).animate({"opacity":"1", "marginTop":"0px"});
  141.  
  142. }, { offset: '90%' });
  143. jQuery('.home_tabs .center, .home .lay4').css({"opacity":"0", "marginTop":"60px"});
  144. jQuery('.home_tabs .center, .home .lay4').waypoint(function() {
  145. jQuery(this).animate({"opacity":"1", "marginTop":"0px"});
  146. }, { offset: '90%' });
  147. }
  148.  
  149. //Layout6 Animation
  150. jQuery('.lay6 .hentry .imgwrap').hoverIntent(function(){
  151. jQuery(this).find('.postitle').fadeOut(200);
  152. jQuery(this).find('.postitle').delay(50).css({"display":"none","width":"92%", "height":"80%", "paddingTop":"20%", "textAlign":"center", "background":"rgba(0, 0, 0, 0.4)", "bottom":"-10px"});
  153. jQuery(this).find('.postitle').fadeIn(200);
  154. var titlehref= jQuery(this).find('.postitle a').attr('href');
  155. jQuery(this).find('.postitle a').append('<div class="icon_wrap"><div class="icon_round"><a href="'+titlehref+'"><i class="fa-link fa-2x"></i></a></div></div>')
  156. }, function(){
  157. jQuery(this).find('.postitle').css({"display":"none","width":"auto%", "height":"auto", "paddingTop":"0", "textAlign":"left", "background":"none", "bottom":"0px"});
  158. jQuery(this).find('.postitle').delay(10).fadeIn(400);
  159. jQuery(this).find(".icon_wrap").remove();
  160. });
  161.  
  162.  
  163.  
  164. //Next Previous post button Link
  165. var link = jQuery('.ast-next > a').attr('href');
  166. jQuery('.right_arro').attr('href', link);
  167.  
  168. var link = jQuery('.ast-prev > a').attr('href');
  169. jQuery('.left_arro').attr('href', link);
  170.  
  171. //Gallery Template
  172. 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> ')
  173. jQuery('#sidebar .fa-double-angle-right').css({"opacity":"0.5"})
  174.  
  175. //Columns Shortcode Clear
  176. jQuery('.col2:eq(1), .col2:eq(3), .col2:eq(5), .col2:eq(7), .col2:eq(9), .col2:eq(11), .col2:eq(13), .col2:eq(15)').after('<div style="clear:both" />');
  177. jQuery('.col3:eq(2), .col3:eq(5), .col3:eq(8), .col3:eq(11), .col3:eq(14), .col3:eq(17), .col3:eq(20), .col3:eq(23)').after('<div style="clear:both" />');
  178. jQuery('.col4:eq(3), .col4:eq(7), .col4:eq(11), .col4:eq(15), .col3:eq(19), .col4:eq(23), .col4:eq(27), .col4:eq(31)').after('<div style="clear:both" />');
  179.  
  180. //Responsive Video Shortcode
  181.  
  182. jQuery('.vid_iframe').each(function () {
  183. var vidheights = jQuery(this).height();
  184. jQuery(this).closest('.ast_vid').css({ 'height':vidheights});
  185.  
  186. });
  187.  
  188. //Shortcode JS
  189. //Tabs Javascript
  190. jQuery(".lgn_tab p:empty").remove();
  191. var i = 1;
  192. jQuery(".tabs-container .tabli a").each(function (){jQuery(this).attr('href', '#tab-'+i+''); i++;});
  193.  
  194. var i = 1;
  195. jQuery(".lgn_tab > div").each(function (){jQuery(this).attr('id', 'tab-'+i+''); i++;});
  196.  
  197. var i = 1;
  198. jQuery(".tabs-container").each(function (){jQuery(this).attr('id', 'tabs-container_'+i+''); i++;});
  199.  
  200. jQuery('#tabs-container_1, #tabs-container_2, #tabs-container_3, #tabs-container_4, #tabs-container_5, #tabs-container_6').easytabs();
  201.  
  202. //Toggle Shortcode
  203. jQuery('.lgn_toggle_content').hide(); // Hide even though it's already hidden
  204. jQuery('.trigger').click(function() {
  205. jQuery(this).closest('.lgn_toggle').find('.lgn_toggle_content').slideToggle("fast"); // First click should toggle to 'show'
  206. return false;
  207. });
  208. jQuery('.lgn_toggle a.trigger').toggle(function(){
  209. jQuery(this).addClass('down');
  210. }, function(){
  211. jQuery(this).removeClass('down');
  212. });
  213.  
  214. //Mobile Menu
  215. var padmenu = jQuery("#simple-menu").html();
  216. jQuery('#simple-menu').sidr({
  217. name: 'sidr-main',
  218. source: '#topmenu'
  219. });
  220. jQuery(".sidr").prepend("<div class='pad_menutitle'>"+padmenu+"<span><i class='fa-times'></i></span></div>");
  221.  
  222. jQuery(".pad_menutitle span").click(function() {
  223. jQuery.sidr('close', 'sidr-main')
  224. preventDefaultEvents: false;
  225.  
  226. });
  227.  
  228.  
  229. //NivoSlider Navigation Bug Fix
  230. if (jQuery(window).width() < 480) {
  231. jQuery(".nivo-control").text('');
  232. }
  233.  
  234. //FIX HEADER4 MENU DISAPPREAING ISSUE
  235. var breakpoint = jQuery('#topmenu').position();
  236. if (jQuery(window).width() < 900) {
  237. if(breakpoint.top >10){
  238. jQuery('#topmenu').css({"display":"none"});
  239. jQuery('#simple-menu').css({"display":"block"});
  240. }
  241. }
  242.  
  243.  
  244. //slider porgressbar loader
  245. jQuery(function () {
  246. var n = 0,
  247. $imgs = jQuery('.slider-wrapper img'),
  248. val = 100 / $imgs.length,
  249. $bar = jQuery('#astbar');
  250. $progrssn = jQuery('.progrssn');
  251.  
  252. $imgs.load(function () {
  253. n = n + val;
  254. // for displaying purposes
  255. $progrssn.width(n + '%');
  256. var numTruncated = parseFloat(n).toFixed(1);
  257. $bar.text(numTruncated);
  258. });
  259.  
  260. });
  261. jQuery('.slider-wrapper').waitForImages(function() {
  262. jQuery("#zn_nivo, .nivo-controlNav, #slide_acord, .nivoinner").css({"display":"block"});
  263. jQuery(".pbar_wrap").fadeOut();
  264. });
  265.  
  266. jQuery(window).load(function(){
  267. jQuery('.nivo-controlNav').css({"display":"block"});
  268.  
  269.  
  270. });
  271.  
  272. //Remove margin from homeblocks after ast_blocks
  273. jQuery(".ast_blocks").next('.home_blocks').css({"marginTop":"0"});
  274. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement