You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
5.0 KiB

  1. $(function () {
  2. $('.modal').on('show.bs.modal', function () {
  3. if ($('.solutions-banner').length > 0) {
  4. $('.solutions-banner').css({
  5. 'padding-right': '15px'
  6. });
  7. }
  8. });
  9. $('.modal').on('hide.bs.modal', function () {
  10. if ($('.solutions-banner').length > 0) {
  11. $('.solutions-banner').css({
  12. 'padding-right': 'inherit'
  13. });
  14. }
  15. });
  16. $(document).scroll(function () {
  17. checkScrollPosition();
  18. });
  19. function checkScrollPosition() {
  20. if ($(document).scrollTop() > 0) {
  21. $('header').addClass('scrolled');
  22. }
  23. else {
  24. $('header').removeClass('scrolled');
  25. }
  26. }
  27. checkScrollPosition();
  28. if (jQuery('body.page-template-pricing').length > 0) {
  29. jQuery('section.tabbed-content:gt(0)').hide();
  30. jQuery('section.solutions-banner a.media').click(function (e) {
  31. //history.pushState({ p: jQuery(this).attr('href') }, '', '');
  32. history.pushState('', '', '?p=' + jQuery(this).attr('href').substr(1));
  33. e.stopPropagation();
  34. switchPricingProducts();
  35. return false;
  36. });
  37. switchPricingProducts();
  38. }
  39. function switchPricingProducts() {
  40. var product = getUrlParameter('p');
  41. if (product) {
  42. jQuery('section.tabbed-content').hide();
  43. jQuery('section.solutions-banner a.media').removeClass('active');
  44. jQuery('section.solutions-banner a.media[href="#' + product + '"]').addClass('active');
  45. jQuery('section.tabbed-content#' + product).show();
  46. }
  47. }
  48. function getUrlParameter(name) {
  49. name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
  50. var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
  51. var results = regex.exec(location.search);
  52. return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
  53. }
  54. ;
  55. jQuery('img.svg').each(function () {
  56. var $img = jQuery(this);
  57. var imgID = $img.attr('id');
  58. var imgClass = $img.attr('class');
  59. var imgURL = $img.attr('src');
  60. jQuery.get(imgURL, function (data) {
  61. // Get the SVG tag, ignore the rest
  62. var $svg = jQuery(data).find('svg');
  63. // Add replaced image's ID to the new SVG
  64. if (typeof imgID !== 'undefined') {
  65. $svg = $svg.attr('id', imgID);
  66. }
  67. // Add replaced image's classes to the new SVG
  68. if (typeof imgClass !== 'undefined') {
  69. $svg = $svg.attr('class', imgClass + ' replaced-svg');
  70. }
  71. // Remove any invalid XML tags as per http://validator.w3.org
  72. $svg = $svg.removeAttr('xmlns:a');
  73. // Check if the viewport is set, if the viewport is not set the SVG wont't scale.
  74. if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
  75. $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'));
  76. }
  77. // Replace image with new SVG
  78. $img.replaceWith($svg);
  79. }, 'xml');
  80. });
  81. setTimeout(function () {
  82. setAngle();
  83. }, 1);
  84. $(window).resize(function () {
  85. setTimeout(function () {
  86. setAngle();
  87. }, 1);
  88. });
  89. });
  90. var setAngle = function () {
  91. if ($('.solutions-content').length) {
  92. solutionsAngle();
  93. }
  94. else if ($('.partners-list').length) {
  95. partnersAngle();
  96. }
  97. };
  98. var calculateAngle = function (opposite, adjacent) {
  99. var oa = opposite / adjacent;
  100. var radian = Math.atan(oa);
  101. var degree = radian * (180 / Math.PI);
  102. var angle = (90 - degree).toFixed(1);
  103. return angle;
  104. };
  105. var solutionsAngle = function () {
  106. var solutions = $('.solutions-content');
  107. var container = solutions.find('.solution-box').first();
  108. if (!solutions.hasClass('bannerless')) {
  109. var o = (container.height() * .4);
  110. var a = container.find('.solution-wrapper').width() * .5;
  111. container.find('.vinny-line.line-2').css('transform', 'skewX(' + calculateAngle(o, a) + 'deg)');
  112. }
  113. };
  114. var partnersAngle = function () {
  115. var partners = $('.partners-list');
  116. var container = partners.find('.partner-box').first();
  117. var o = (container.height() * .4);
  118. var a = container.find('.container-semifluid').width() * .5;
  119. container.find('.vinny-line.line-2').css('transform', 'skewX(' + calculateAngle(o, a) + 'deg)');
  120. if (partners.hasClass('skew-vinnyline')) {
  121. var skewStartContainer = partners.find('.partner-box:nth-child(4)');
  122. var skewStartO = (skewStartContainer.height() * .4);
  123. var skewStartA = skewStartContainer.find('.container-semifluid').width() * .25;
  124. skewStartContainer.find('.vinny-line.line-2').css('transform', 'skewX(' + -calculateAngle(skewStartO, skewStartA) + 'deg)');
  125. var skewEndContainer = partners.find('.partner-box:nth-child(5)');
  126. skewEndContainer.find('.vinny-line:not(.line-2)').css('transform', 'skewX(' + -calculateAngle(skewStartO - 1, skewStartA) + 'deg)');
  127. }
  128. };