script.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. jQuery(document).ready(function($) {
  2. //window scrolls check
  3. $(window).scroll(function() {
  4. var topOfWindow = $(window).scrollTop();
  5. console.log('topOfWindow',topOfWindow);
  6. if (topOfWindow > 100) {
  7. $("#top-bar").addClass("reduced");
  8. }
  9. else {
  10. $("#top-bar").removeClass("reduced");
  11. }
  12. });
  13. // init categories content images behaviour
  14. if($('body').is('.categories')){
  15. var $diapo = $('<div id="diaporama"></div>');
  16. $("#categories-content")
  17. .before($diapo)
  18. .children('section.projet-block').each(function(index, el) {
  19. $(this)
  20. .addClass('projet-'+index)
  21. .hover(function (e) {
  22. $diapo.children().removeClass('visible');
  23. var c = $(this).attr('class').match('projet-[0-9]+');
  24. console.log("class",c[0]);
  25. $diapo.children('.'+c[0]).addClass('visible');
  26. })
  27. .find('.projet-img')
  28. .addClass('projet-'+index)
  29. .appendTo($diapo);
  30. });
  31. $diapo.children('.projet-img').first().addClass('visible');
  32. }
  33. // init Masonry
  34. var $grid = $('.grid').masonry({
  35. itemSelector: '.grid-block'
  36. // columnWidth: 200
  37. });
  38. // layout Masonry after each image loads
  39. // $grid.imagesLoaded().progress( function() {
  40. // $grid.masonry('layout');
  41. // });
  42. });