site.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // function hovercat() {
  2. // var $work = $('.navbar > ul > li:nth-child(1)');
  3. // var $workafter = $('.navbar > ul > li:nth-child(1)::after');
  4. // var $cat = $('.navbar > ul.tags');
  5. //
  6. // $work.hover(
  7. // function() {
  8. // $( this ).addClass( "hover" );
  9. // $(this).parents().find('.tags').addClass("visible");
  10. // }, function() {
  11. // $( this ).removeClass( "hover" );
  12. // $(this).parents().find('.tags').removeClass("visible");
  13. // }
  14. // );
  15. //
  16. // $cat.hover(
  17. // function() {
  18. // $( this ).addClass( "visible" );
  19. // $(this).parents().find($work).addClass('hover');
  20. // }, function() {
  21. // $( this ).removeClass( "visible" );
  22. // $(this).parents().find($work).removeClass('hover');
  23. // }
  24. // );
  25. // }
  26. function catprojets() {
  27. $(window).load(function () {
  28. var $content = $('.content');
  29. var $txt = $('#items .content .txt');
  30. var $cat = $('#items .content .taxonomy');
  31. var $Hcontent = $content.outerHeight();
  32. var $Hcat = $cat.outerHeight();
  33. var $Htxt = $Hcontent - $Hcat;
  34. $txt.css({
  35. "height" : $Htxt + "px"
  36. });
  37. });
  38. }
  39. function removeAct(){
  40. var $cat = $('.navbar > ul.tags');
  41. var $work = $('.navbar > ul:first-child > li:first-child .cat');
  42. var $start = $("body #start");
  43. $work.click(function(event) {
  44. event.preventDefault();
  45. $(this).parents('.navbar').find('.tags').toggleClass('visible');
  46. $(this).parents('.navbar').find(' ul > li:first-child').toggleClass('act');
  47. });
  48. $start.click(function(event) {
  49. $(this).parents('#top').find('.tags').removeClass('visible');
  50. $(this).parents('#top').find(' ul > li:first-child').removeClass('act');
  51. });
  52. }
  53. function scrollreveal() {
  54. var slideUp = {
  55. distance: '0%',
  56. interval: 20,
  57. origin: 'top',
  58. };
  59. ScrollReveal().reveal('.card', slideUp);
  60. ScrollReveal().reveal('#body-wrapper img', slideUp);
  61. ScrollReveal().reveal('.item .news', slideUp);
  62. }
  63. function burger() {
  64. var $col = $('.col');
  65. var $colOpen = $('.navbar ul.open');
  66. $col.click(function(e){
  67. $(this).parents('.navbar').find('ul:first-child').toggleClass('open');
  68. })
  69. }
  70. function deplacement_cat() {
  71. var $cat = $('.navbar .tags');
  72. var $projets = $('.navbar ul li:first-child');
  73. var result = document.getElementById('result');
  74. if (window.matchMedia("(min-width: 700px)").matches) {
  75. /* La largeur minimum de l'affichage est 600 px inclus */
  76. } else {
  77. /* L'affichage est inférieur à 600px de large */
  78. $projets.after($cat);
  79. }
  80. if("matchMedia" in window) { // Détection
  81. if(window.matchMedia("(min-width:700px)").matches) {
  82. } else {
  83. $projets.after($cat);
  84. }
  85. }
  86. }
  87. jQuery(document).ready(function($) {
  88. burger();
  89. scrollreveal();
  90. removeAct();
  91. catprojets();
  92. deplacement_cat();
  93. window.addEventListener('resize', deplacement_cat, false);
  94. });