Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name     ragl header UX improvement
  3. // @version  1
  4. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  5. // @include  http://ragl.org/*
  6. // ==/UserScript==
  7.  
  8. fb = $(".container")[0];
  9. $("#header_meta").remove();
  10. $("#header_main").append(fb);
  11. $("#header_main").css({"position":"relative","padding":"8px"});
  12. $(fb).css({
  13.     "position": "absolute",
  14.     "top": "21px",
  15.     "right": "3px",
  16.     "width": "30px",
  17.     "height": "30px"
  18. });
  19. $("#main").css({"padding-top":"150px"});
  20. $("#header_main_alternate").css({
  21.   "margin-top":"8px",
  22.     "z-index":"1"
  23. });
  24.  
  25. lg = $(".logo a").clone();
  26. lg.attr('id','newlogo');
  27. $("#header_main").append(lg);
  28.  
  29. $("#newlogo").css({
  30.     "position":"absolute",
  31.     "top": "2px",
  32.     "left": "45px"
  33. });
  34. $("#newlogo").css({
  35.     "height":"60px",
  36.     "width":"180px",
  37.     "z-index":"2",
  38.     "display":"none"
  39. });
  40.  
  41. document.addEventListener("scroll", morphHeader);
  42.  
  43. function morphHeader(){
  44.     if(document.scrollingElement.scrollTop>100){
  45.         $(".container.av-logo-container").slideUp(200);
  46.         if($(window).width() > 1360) $("#newlogo").fadeIn();
  47.     }else{
  48.         $(".container.av-logo-container").slideDown(200);
  49.         $("#newlogo").fadeOut();
  50.     }
  51. }
  52.  
  53. window.addEventListener("resize", checkSize);
  54.  
  55. function checkSize(){
  56.  
  57.   if($(window).width() < 1360) $("#newlogo").fadeOut();
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement