PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/html/js/custom.js

https://gitlab.com/lambdomotive/slavuta_vinzem
JavaScript | 166 lines | 96 code | 34 blank | 36 comment | 1 complexity | 71867ea197c9e893ddec8efc56150614 MD5 | raw file
  1. jQuery(document).ready(function() {
  2. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3. // change ourservice on mobile version
  4. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5. domready(function(){
  6. selectnav('mainourservice', {
  7. label: 'ourservice',
  8. nested: true,
  9. indent: '-'
  10. });
  11. });
  12. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  13. // filtering gallery
  14. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  15. var $container = jQuery('#gallery');
  16. $container.isotope({
  17. itemSelector: '.item',
  18. filter: '*',
  19. });
  20. jQuery('#filters a').click(function(){
  21. var $this = jQuery(this);
  22. if ( $this.hasClass('selected') ) {
  23. return false;
  24. }
  25. var $optionSet = $this.parents();
  26. $optionSet.find('.selected').removeClass('selected');
  27. $this.addClass('selected');
  28. var selector = jQuery(this).attr('data-filter');
  29. $container.isotope({
  30. filter: selector,
  31. });
  32. return false;
  33. });
  34. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  35. // paralax background
  36. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  37. $window = jQuery(window);
  38. jQuery('section[data-type="background"]').each(function(){
  39. var $bgobj = jQuery(this); // assigning the object
  40. jQuery(window).scroll(function() {
  41. var yPos = -($window.scrollTop() / $bgobj.data('speed'));
  42. var coords = '50% '+ yPos + 'px';
  43. $bgobj.css({ backgroundPosition: coords });
  44. });
  45. });
  46. document.createElement("article");
  47. document.createElement("section");
  48. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  49. // prettyPhoto function
  50. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  51. jQuery("area[data-gal^='prettyPhoto']").prettyPhoto();
  52. jQuery("body:first a[data-gal^='prettyPhoto']").prettyPhoto({animation_speed:'fast',theme:'light_square',slideshow:3000, autoplay_slideshow: false});
  53. jQuery("body:gt(0) a[data-gal^='prettyPhoto']").prettyPhoto({animation_speed:'fast',slideshow:10000, hideflash: true});
  54. jQuery("#custom_content a[data-gal^='prettyPhoto']:first").prettyPhoto({
  55. custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
  56. changepicturecallback: function(){ initialize(); }
  57. });
  58. jQuery("#custom_content a[data-gal^='prettyPhoto']:last").prettyPhoto({
  59. custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
  60. changepicturecallback: function(){ _bsap.exec(); }
  61. });
  62. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  63. // scroll to top
  64. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  65. jQuery().UItoTop({ easingType: 'easeInOutExpo' });
  66. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  67. // gallery hover
  68. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  69. jQuery('.gallery .item').hover(function() {
  70. jQuery(this).stop().animate({opacity: .5}, 100);
  71. }, function() {
  72. jQuery(this).stop().animate({opacity: 1});}, 100);
  73. jQuery('.img-hover').hover(function() {
  74. jQuery(this).stop().animate({opacity: .5}, 100);
  75. }, function() {
  76. jQuery(this).stop().animate({opacity: 1});}, 100);
  77. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  78. // resize
  79. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  80. window.onresize = function(event) {
  81. jQuery('#gallery').isotope('reLayout');
  82. };
  83. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  84. // show / hide slider navigation
  85. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  86. jQuery('.main-slider.flexslider').flexslider({
  87. animation: "slide",
  88. directionNav: false,
  89. start: function () {
  90. //jQuery(".slider-info").animate({"margin-left": "auto", "opacity": "toggle"},500);
  91. },
  92. after: function () {
  93. //jQuery(".slider-info").animate({"margin-left": "auto", "opacity": "toggle"},500);
  94. },
  95. before: function () {
  96. //jQuery(".slider-info").animate({"margin-left": "90", "opacity": "toggle"},300);
  97. }
  98. });
  99. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  100. // lazyload
  101. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  102. jQuery(function() {
  103. jQuery("img").lazyload({
  104. effect : "fadeIn",
  105. effectspeed: 900
  106. });
  107. });
  108. // --------------------------------------------------
  109. // tabs
  110. // --------------------------------------------------
  111. jQuery('.lt_tab').find('.lt_tab_content div').hide();
  112. jQuery('.lt_tab').find('.lt_tab_content div:first').show();
  113. jQuery('.lt_nav li').click(function() {
  114. jQuery(this).parent().find('li span').removeClass("active");
  115. jQuery(this).find('span').addClass("active");
  116. jQuery(this).parent().parent().find('.lt_tab_content div').hide();
  117. var indexer = jQuery(this).index(); //gets the current index of (this) which is #nav li
  118. jQuery(this).parent().parent().find('.lt_tab_content div:eq(' + indexer + ')').fadeIn(); //uses whatever index the link has to open the corresponding box
  119. });
  120. });
  121. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  122. // lazyload
  123. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  124. jQuery(document).ready(function() {
  125. var $header = $("header"),
  126. $clone = $header.before($header.clone().addClass("clone"));
  127. jQuery(window).on("scroll", function() {
  128. var fromTop = jQuery(window).scrollTop();
  129. console.log(fromTop);
  130. jQuery("body").toggleClass("down", (fromTop > 240));
  131. });
  132. });