PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/k2/javascript/gdl-scripts.js

https://bitbucket.org/summitds/bloomsburgpa.org
JavaScript | 219 lines | 155 code | 36 blank | 28 comment | 13 complexity | 077c712d33950b6dbf0c737f8e550d3b MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.1
  1. jQuery(document).ready(function(){
  2. // Menu Navigation
  3. jQuery('#main-superfish-wrapper ul.sf-menu').supersubs({
  4. minWidth: 14.5,
  5. maxWidth: 27,
  6. extraWidth: 1
  7. }).superfish({
  8. delay: 100,
  9. speed: 'fast',
  10. animation: {opacity:'show',height:'show'}
  11. });
  12. // Accordion
  13. jQuery("ul.gdl-accordion li").each(function(){
  14. //jQuery(this).children(".accordion-content").css('height', function(){
  15. //return jQuery(this).height();
  16. //});
  17. if(jQuery(this).index() > 0){
  18. jQuery(this).children(".accordion-content").css('display','none');
  19. }else{
  20. jQuery(this).find(".accordion-head-image").addClass('active');
  21. }
  22. jQuery(this).children(".accordion-head").bind("click", function(){
  23. jQuery(this).children().addClass(function(){
  24. if(jQuery(this).hasClass("active")) return "";
  25. return "active";
  26. });
  27. jQuery(this).siblings(".accordion-content").slideDown();
  28. jQuery(this).parent().siblings("li").children(".accordion-content").slideUp();
  29. jQuery(this).parent().siblings("li").find(".active").removeClass("active");
  30. });
  31. });
  32. // Toggle Box
  33. jQuery("ul.gdl-toggle-box li").each(function(){
  34. //jQuery(this).children(".toggle-box-content").css('height', function(){
  35. //return jQuery(this).height();
  36. //});
  37. jQuery(this).children(".toggle-box-content").not(".active").css('display','none');
  38. jQuery(this).children(".toggle-box-head").bind("click", function(){
  39. jQuery(this).children().addClass(function(){
  40. if(jQuery(this).hasClass("active")){
  41. jQuery(this).removeClass("active");
  42. return "";
  43. }
  44. return "active";
  45. });
  46. jQuery(this).siblings(".toggle-box-content").slideToggle();
  47. });
  48. });
  49. // Search Movement
  50. jQuery(".search-wrapper").filter(":first").find("#searchsubmit").click(function(){
  51. if( jQuery(this).siblings("#search-text").width() == 1 ){
  52. jQuery(this).siblings("#search-text").children("input[type='text']").val('');
  53. jQuery(this).siblings("#search-text").animate({ width: '170px' });
  54. jQuery(this).siblings("#search-text").children("input[type='text']").focus();
  55. return false;
  56. }
  57. if( jQuery(this).siblings("#search-text").children("input[type='text']").val() == '' ){
  58. return false;
  59. }
  60. });
  61. jQuery("#searchform").click(function(){
  62. if (event.stopPropagation){
  63. event.stopPropagation();
  64. }
  65. else if(window.event){
  66. window.event.cancelBubble=true;
  67. }
  68. //event.stopPropagation();
  69. });
  70. jQuery("html").click(function(){
  71. jQuery(this).find(".search-wrapper").filter(":first").find("#search-text").animate({ width: '1px' });
  72. });
  73. // Social Hover
  74. jQuery(".social-icon").hover(function(){
  75. jQuery(this).animate({ opacity: 1 }, 150);
  76. }, function(){
  77. jQuery(this).animate({ opacity: 0.55 }, 150);
  78. });
  79. // Scroll Top
  80. jQuery('div.scroll-top').click(function() {
  81. jQuery('html, body').animate({ scrollTop:0 }, '1000');
  82. return false;
  83. });
  84. // Blog Hover
  85. jQuery(".blog-thumbnail-image img").hover(function(){
  86. jQuery(this).animate({ opacity: 0.55 }, 150);
  87. }, function(){
  88. jQuery(this).animate({ opacity: 1 }, 150);
  89. });
  90. // Gallery Hover
  91. jQuery(".gallery-thumbnail-image img").hover(function(){
  92. jQuery(this).animate({ opacity: 0.55 }, 150);
  93. }, function(){
  94. jQuery(this).animate({ opacity: 1 }, 150);
  95. });
  96. // Port Hover
  97. jQuery("#portfolio-item-holder .portfolio-thumbnail-image-hover").hover(function(){
  98. jQuery(this).animate({ opacity: 0.55 }, 400, 'easeOutExpo');
  99. jQuery(this).find('span').animate({ left: '50%'}, 300, 'easeOutExpo');
  100. }, function(){
  101. jQuery(this).find('span').animate({ left: '150%'}, 300, 'easeInExpo', function(){
  102. jQuery(this).css('left','-50%');
  103. });
  104. jQuery(this).animate({ opacity: 0 }, 400, 'easeInExpo');
  105. });
  106. // Price Table
  107. jQuery(".gdl-price-item").each(function(){
  108. var max_height = 0;
  109. jQuery(this).find('.price-item').each(function(){
  110. if( max_height < jQuery(this).height()){
  111. max_height = jQuery(this).height();
  112. }
  113. });
  114. jQuery(this).find('.price-item').height(max_height);
  115. });
  116. });
  117. jQuery(window).load(function(){
  118. // Set Portfolio Max Height
  119. var port_item_holder = jQuery('div#portfolio-item-holder');
  120. port_item_holder.equalHeights();
  121. jQuery(window).resize(function(){
  122. port_item_holder.children().css('min-height','0');
  123. port_item_holder.equalHeights();
  124. });
  125. // Set Sidebar height
  126. var content_wrapper = jQuery('.content-wrapper').filter(':first');
  127. var left_sidebar_wrapper = content_wrapper.find('.left-sidebar-wrapper').filter(':first');
  128. var right_sidebar_wrapper = content_wrapper.find('.right-sidebar-wrapper').filter(':first');
  129. content_wrapper.each(function(){
  130. max_height = jQuery(this).height();
  131. top_slider_height = jQuery(this).find('.slider-wrapper.fullwidth').height();
  132. max_height = max_height - top_slider_height;
  133. left_sidebar_wrapper.height(max_height);
  134. right_sidebar_wrapper.height(max_height);
  135. });
  136. jQuery(window).resize(function(){
  137. left_sidebar_wrapper.css('height', 'auto');
  138. right_sidebar_wrapper.css('height', 'auto');
  139. content_wrapper.each(function(){
  140. max_height = jQuery(this).height();
  141. top_slider_height = jQuery(this).find('.slider-wrapper.fullwidth').height();
  142. max_height = max_height - top_slider_height;
  143. left_sidebar_wrapper.height(max_height);
  144. right_sidebar_wrapper.height(max_height);
  145. });
  146. });
  147. });
  148. /* Tabs Activiation
  149. ================================================== */
  150. jQuery(document).ready(function() {
  151. var tabs = jQuery('ul.tabs');
  152. tabs.each(function(i) {
  153. //Get all tabs
  154. var tab = jQuery(this).find('> li > a');
  155. tab.click(function(e) {
  156. //Get Location of tab's content
  157. var contentLocation = jQuery(this).attr('href');
  158. //Let go if not a hashed one
  159. if(contentLocation.charAt(0)=="#") {
  160. e.preventDefault();
  161. //Make Tab Active
  162. tab.removeClass('active');
  163. jQuery(this).addClass('active');
  164. //Show Tab Content & add active class
  165. jQuery(contentLocation).show().addClass('active').siblings().hide().removeClass('active');
  166. }
  167. });
  168. });
  169. });
  170. /* Equal Height Function
  171. ================================================== */
  172. (function($) {
  173. $.fn.equalHeights = function(px) {
  174. $(this).each(function(){
  175. var currentTallest = 0;
  176. $(this).children().each(function(i){
  177. if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
  178. });
  179. $(this).children().css({'min-height': currentTallest});
  180. });
  181. return this;
  182. };
  183. })(jQuery);