Advertisement
greenmelon

draggable music player

Dec 14th, 2021
1,485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. <head>
  2. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css" integrity="sha384-HzLeBuhoNPvSl5KYnjx0BT+WB0QEEqLprO+NBkkk5gbc67FTaL7XIGa2w1L0Xbgc" crossorigin="anonymous">
  3. </head>
  4.  
  5. <style type="text/css">
  6. #musicplayer {
  7. display:grid;
  8. grid-template-columns:18px auto;
  9. align-items:center
  10. width: 90px;
  11. height: 24px;
  12.  
  13. font-size:11px;
  14. font-family: kosugi;
  15. color:#955136;
  16.  
  17. line-height:200%;
  18.  
  19. background:white;
  20.  
  21. border: 2px solid #F9CDE2;
  22. border-radius: 2px;
  23.  
  24. }
  25.  
  26. #musictitle{
  27. overflow: hidden;
  28. white-space: nowrap;
  29. -webkit-filter: drop-shadow(0px 0px 2px #FFB0C9);
  30. display:inline-block;
  31. width: calc(109% - 10px - 0px);
  32. margin-left: calc(4px + 0px);
  33. }
  34.  
  35. #musicpixel{
  36. width:120%;
  37. padding-top:0px;
  38. position:relative;
  39.  
  40. min-height: 20px;
  41.  
  42. background:white;
  43.  
  44. border-right: 2px solid #F9CDE2;
  45. }
  46.  
  47. .overlay {
  48. opacity:0;
  49. position:absolute;
  50. top:0;
  51. left:0;
  52. text-align:center;
  53. width:100%;
  54. height:100%;
  55. transition:0.3s ease;
  56.  
  57. background:white;
  58. }
  59.  
  60. #musicplayer:hover .overlay {
  61. opacity: 1;
  62. transition:0.3s ease;
  63. }
  64.  
  65. .playpause{
  66. position: absolute;
  67. top: 50%;
  68. left: 50%;
  69. transform: translate(-50%, -50%);
  70. }
  71.  
  72. .playpause:hover{
  73. cursor:help;
  74. }
  75.  
  76. #musicpixel img{
  77. display:block;
  78. }
  79.  
  80. .marquee{
  81. display: inline-block;
  82. padding-left: 100%;
  83. animation: marquee 7s linear infinite;
  84. }
  85.  
  86. @keyframes marquee{
  87. 0% {
  88. transform: translate(0, 0);
  89. }
  90. 100% {
  91. transform: translate(-100%, 0);
  92. }
  93. }
  94. </style>
  95.  
  96. <body>
  97.  
  98. <!--make sure to import fontawesome cdn <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css" integrity="sha384-HzLeBuhoNPvSl5KYnjx0BT+WB0QEEqLprO+NBkkk5gbc67FTaL7XIGa2w1L0Xbgc" crossorigin="anonymous"> in the head-->
  99.  
  100. <div id='musicplayer'>
  101. <div id='musicpixel'>
  102. <img src='https://graphic.neocities.org/tumblr_inline_oeqayhhdhP1uqb749_500.gif'>
  103. <div class='overlay'>
  104. <div class='playpause'><i class="fas fa-play"></i></div>
  105. </div>
  106. </div>
  107. <div id='musictitle'>
  108. <span class='marquee'>this music player is draggable on desktop :)</span>
  109. </div>
  110. </div>
  111.  
  112. <audio id='musicsrc' loop src='https://dl.dropbox.com/s/6sfaqetvhk87pic/Just%20A%20Feeling.mp3'></audio>
  113. </body>
  114.  
  115. <script>
  116. document.querySelector('.playpause').addEventListener('click', playpause);
  117.  
  118. function playpause(){
  119. if(document.querySelector('.playpause').innerHTML == '<i class="fas fa-play"></i>'){
  120. document.querySelector('#musicsrc').play();
  121. document.querySelector('.playpause').innerHTML = '<i class="fas fa-pause"></i>';
  122. } else{
  123. document.querySelector('#musicsrc').pause();
  124. document.querySelector('.playpause').innerHTML = '<i class="fas fa-play"></i>';
  125. }
  126.  
  127. }
  128. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement