script.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. function hover() {
  2. $( ".layout-sidebar-second" ).hover(
  3. function() {
  4. $( ".opacity" ).addClass( "hover" );
  5. }, function() {
  6. $( ".opacity" ).removeClass( "hover" );
  7. }
  8. );
  9. }
  10. function drag() {
  11. var random = Math.floor(Math.random() * 3);
  12. var $li = $(".home .layout-sidebar-second .views-element-container");
  13. $li.eq(random % $li.length).addClass("fluxalone");
  14. document.getElementById("edit-submit").value = "";
  15. $( ".txt-vanina .views-row .views-field:nth-child(-n+4)" ).wrapAll( "<div class='entête'/>" );
  16. $( "#block-vanina-page-title" ).prependTo( ".en-tete" );
  17. $( ".date-articles" ).prependTo( "#block-vanina-page-title" );
  18. var a = 3;
  19. $(".layout-sidebar-second .views-element-container").draggable({
  20. addClasses:true,
  21. stack: ".drag",
  22. axis : "x",
  23. start: function(event, ui) { $(this).css("z-index", a++); },
  24. stop: function()
  25. {
  26. $(this).css({
  27. 'width': '30%',
  28. })
  29. }
  30. });
  31. $(" .fluxalone").css({ 'left': '50vw' })
  32. }
  33. function retour() {
  34. $('.bouton_retour').click(function(e){
  35. e.preventDefault();
  36. $('.layout-sidebar-second .views-element-container:nth-child(1)').animate({ 'left': '95vw' }, 500)
  37. $('.layout-sidebar-second .views-element-container:nth-child(1)').css({'z-index' : '10'});
  38. $('.layout-sidebar-second .views-element-container:nth-child(2)').animate({ 'left': '90vw' }, 500)
  39. $('.layout-sidebar-second .views-element-container:nth-child(2)').css({'z-index' : '9'});
  40. $('.layout-sidebar-second .views-element-container:nth-child(3)').animate({ 'left': '85vw' }, 500)
  41. $('.layout-sidebar-second .views-element-container:nth-child(3)').css({'z-index' : '8'});
  42. })
  43. }
  44. function degrader() {
  45. var degrade_vert = $('#block-views-block-page-etudiant-block-1 .degrader');
  46. $('.layout-sidebar-second .views-element-container:nth-child(1)').on('scroll', function() {
  47. var st = $(this).scrollTop();
  48. degrade_vert.css({ 'opacity' : -(1 - st/100), 'top': st + 'px' });
  49. });
  50. var degrade_violet = $('#block-views-block-une-saison-graphique-block-1 .degrader');
  51. $('.layout-sidebar-second .views-element-container:nth-child(2)').on('scroll', function() {
  52. var st = $(this).scrollTop();
  53. degrade_violet.css({ 'opacity' : -(1 - st/100), 'top': st + 'px' });
  54. });
  55. var degrade_rouge = $('#block-views-block-expositions-block-1 .degrader');
  56. $('.layout-sidebar-second .views-element-container:nth-child(3)').on('scroll', function() {
  57. var st = $(this).scrollTop();
  58. degrade_rouge.css({ 'opacity' : -(1 - st/100), 'top': st + 'px' });
  59. });
  60. }
  61. (function($) {
  62. retour();
  63. degrader();
  64. hover();
  65. drag();
  66. })(jQuery);