script.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. // console.log($(window).width());
  15. if( $(window).width() > 600 ){
  16. if($('body').is('.categories')){
  17. // console.log('hello');
  18. var $diapo = $('<div id="diaporama"></div>');
  19. $("#categories-content")
  20. .before($diapo)
  21. .find('li.project').each(function(index, el) {
  22. // console.log(index);
  23. $(this)
  24. .addClass('projet-'+index)
  25. .hover(function (e) {
  26. $diapo.children().removeClass('visible');
  27. var c = $(this).attr('class').match('projet-[0-9]+');
  28. console.log("class",c[0]);
  29. $diapo.children('.'+c[0]).addClass('visible');
  30. })
  31. .find('.projet-img')
  32. .addClass('projet-'+index)
  33. .appendTo($diapo);
  34. });
  35. $diapo.children('.projet-img').first().addClass('visible');
  36. }
  37. // init Masonry
  38. var $grid = $('.grid').masonry({
  39. itemSelector: '.grid-block',
  40. transitionDuration: '0.4s'
  41. });
  42. $grid.imagesLoaded().progress(function(){
  43. $grid.masonry('layout');
  44. });
  45. }
  46. });