当前位置:   article > 正文

js css 悬浮动画字体_前端悬浮显示字 cursor

前端悬浮显示字 cursor
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title></title>
  6. <link rel="stylesheet" href="./myStyle.css">
  7. <link rel="stylesheet" href="animate.min.css">
  8. <script src="./jquery-3.1.1.min.js"></script>
  9. <script src="./wow.min.js"></script>
  10. </head>
  11. <body>
  12. <div class="sidbar">
  13. <!-- 挂件 -->
  14. <details class="open">
  15. <summary>
  16. <span></span>
  17. <span></span>
  18. <span></span>
  19. </summary>
  20. </details>
  21. <ul class="menu tupCass">
  22. <li class="htmlspan">
  23. </li>
  24. <!-- <li class="htmlspan">
  25. </li>
  26. <li class="htmlspan">
  27. </li>
  28. <li class="htmlspan">
  29. </li> -->
  30. </ul>
  31. </div>
  32. <script type="text/javascript">
  33. var wow = new WOW({
  34. boxClass: 'wow',
  35. animateClass: 'animated',
  36. offset: 0,
  37. mobile: true,
  38. live: true
  39. });
  40. let open = document.querySelector(".open")
  41. let sidbar = document.querySelector(".sidbar")
  42. let isOpen = false
  43. open.onclick = () => {
  44. wow.init();
  45. if (isOpen == true) {
  46. sidbar.classList.remove('sidbar-avtive')
  47. open.classList.remove('active')
  48. } else {
  49. sidbar.classList.add('sidbar-avtive')
  50. open.classList.add('active')
  51. }
  52. isOpen = !isOpen
  53. var span_text = "abcdepoijhtydqq"
  54. dongHua(span_text)
  55. }
  56. function dongHua(span_text) {
  57. let l = span_text.length
  58. let sz = 0
  59. let init = 0
  60. if (l % 2) { //奇数
  61. sz = Math.floor(l / 2) //商
  62. init = 0
  63. } else { //偶数
  64. sz = l / 2
  65. init = 1
  66. }
  67. let arr = []
  68. let span_html = '';
  69. for (let i = init; i <= sz; i++) {
  70. //奇数
  71. let zarr = []
  72. if (l % 2) {
  73. if (i == init) {
  74. span_html = `<span class="id${i}">${span_text[sz]}</span>`
  75. console.log("span_html", span_html)
  76. zarr.push(span_html)
  77. // zarr.push({
  78. // htmlName:a[sz],
  79. // id:`id${i}`
  80. // })
  81. // `id${i}`
  82. } else {
  83. span_html = `<span class="id${i}">${span_text[sz-i]}</span>`
  84. zarr.push(span_html)
  85. span_html = `<span class="id${i}">${span_text[sz+i]}</span>`
  86. zarr.push(span_html)
  87. // $(".htmlspan").html(span_html)
  88. // $(".htmlspan").html(span_html1)
  89. // zarr.push({
  90. // htmlName:[sz-i],
  91. // id:`id${i}`
  92. // })
  93. // zarr.push({
  94. // htmlName:a[sz+i],
  95. // id:`id${i}`
  96. // })
  97. }
  98. } else {
  99. if (i == init) {
  100. // zarr.push({
  101. // htmlName:a[(sz-i)],
  102. // id:`id${i-1}`
  103. // })
  104. // zarr.push({
  105. // htmlName:a[(sz)],
  106. // id:`id${i-1}`
  107. // })
  108. span_html = `<span class="id${i}">${span_text[sz-i]}</span>`
  109. zarr.push(span_html)
  110. span_html = `<span class="id${i}">${span_text[sz]}</span>`
  111. zarr.push(span_html)
  112. } else {
  113. // zarr.push({
  114. // htmlName:a[(sz-i)],
  115. // id:`id${i-1}`
  116. // })
  117. // zarr.push({
  118. // htmlName:a[(sz+i-1)],
  119. // id:`id${i-1}`
  120. // })
  121. span_html = `<span class="id${i}">${span_text[sz-i]}</span>`
  122. zarr.push(span_html)
  123. span_html = `<span class="id${i}">${span_text[sz+i-1]}</span>`
  124. zarr.push(span_html)
  125. }
  126. }
  127. arr.push(zarr)
  128. // arr.push(zarr)
  129. }
  130. console.log("arr", arr)
  131. var newArr = []
  132. for (let index = 0; index < arr.length; index++) {
  133. if (index == 0) {
  134. newArr.push(arr[index][0])
  135. } else {
  136. newArr.unshift(arr[index][0])
  137. newArr.push(arr[index][1])
  138. }
  139. }
  140. console.log("newArr", newArr)
  141. // for (let j = 0; j < newArr.length; j++) {
  142. // span_html += newArr[j]
  143. // console.log("span_html",span_html)
  144. // }
  145. span_html = newArr.join('')
  146. $(".htmlspan").html(span_html)
  147. setTimeout(() => {
  148. for (let i = 0; i <= sz; i++) {
  149. console.log("i", i)
  150. setTimeout(() => {
  151. let a = document.querySelectorAll(`.id${i}`)
  152. console.log(a)
  153. if (i == 0) {
  154. a[0].style.transform = "translateY(-150px)"
  155. a[0].style.transition = "all 1s"
  156. } else {
  157. a[0].style.transform = "translateY(-150px)"
  158. a[0].style.transition = "all 1s"
  159. a[1].style.transform = "translateY(-150px)"
  160. a[1].style.transition = "all 1s"
  161. }
  162. }, 50 * i)
  163. }
  164. }, 100)
  165. }
  166. $(".menu >li").hover(function() {
  167. var span_text = "abcdepoijhtydqq"
  168. let l = span_text.length
  169. let sz = 0
  170. let init = 0
  171. sz = Math.floor(l / 2) //商
  172. for (let i = 0; i <= sz; i++) {
  173. console.log("i", i)
  174. setTimeout(() => {
  175. let a = document.querySelectorAll(`.id${i}`)
  176. console.log(a)
  177. if (i == 0) {
  178. a[0].style.transform = "translateY(-300px)"
  179. a[0].style.transition = "all 1s"
  180. } else {
  181. a[0].style.transform = "translateY(-300px)"
  182. a[0].style.transition = "all 1s"
  183. a[1].style.transform = "translateY(-300px)"
  184. a[1].style.transition = "all 1s"
  185. }
  186. }, 50 * i)
  187. }
  188. }, function() {
  189. var span_text = "abcdepoijhtydqq"
  190. let l = span_text.length
  191. let sz = 0
  192. let init = 0
  193. sz = Math.floor(l / 2) //商
  194. for (let i = 0; i <= sz; i++) {
  195. console.log("i", i)
  196. setTimeout(() => {
  197. let a = document.querySelectorAll(`.id${i}`)
  198. console.log(a)
  199. if (i == 0) {
  200. a[0].style.transform = "translateY(-150px)"
  201. a[0].style.transition = "all 1s"
  202. } else {
  203. a[0].style.transform = "translateY(-150px)"
  204. a[0].style.transition = "all 1s"
  205. a[1].style.transform = "translateY(-150px)"
  206. a[1].style.transition = "all 1s"
  207. }
  208. }, 50 * i)
  209. }
  210. })
  211. // $(".menu >li").mouseleave(function(){
  212. // var span_text = "abcdepoijhtydqq"
  213. // let l = span_text.length
  214. // let sz = 0
  215. // let init = 0
  216. // sz = Math.floor(l/2) //商
  217. // for (let i = 0; i <= sz; i++) {
  218. // console.log("i",i)
  219. // setTimeout(()=>{
  220. // let a = document.querySelectorAll(`.id${i}`)
  221. // console.log(a)
  222. // if(i == 0){
  223. // a[0].style.transform = "translateY(-300px)"
  224. // a[0].style.transition = "all 1s"
  225. // }else{
  226. // a[0].style.transform = "translateY(-300px)"
  227. // a[0].style.transition = "all 1s"
  228. // a[1].style.transform = "translateY(-300px)"
  229. // a[1].style.transition = "all 1s"
  230. // }
  231. // },50*i)
  232. // }
  233. // })
  234. </script>
  235. </body>
  236. </html>
  1. body,//myStyle 文件夹
  2. div,
  3. dl,
  4. dt,
  5. ul,
  6. li,
  7. h1,
  8. h2,
  9. h3,
  10. h4,
  11. h5,
  12. h6,
  13. pre,
  14. form,
  15. fieldset,
  16. legend,
  17. input,
  18. textarea,
  19. button,
  20. p,
  21. blockquote,
  22. th,
  23. td {
  24. margin: 0;
  25. padding: 0;
  26. }
  27. * {
  28. margin: 0;
  29. padding: 0;
  30. }
  31. li {
  32. list-style-type: none;
  33. }
  34. a {
  35. text-decoration: none;
  36. }
  37. /* 图片居中显示 */
  38. img,
  39. input,
  40. button {
  41. border: none;
  42. vertical-align: middle;
  43. }
  44. /* 单行省略 */
  45. .row {
  46. overflow: hidden;
  47. text-overflow: ellipsis;
  48. white-space: nowrap;
  49. }
  50. /* 2行省略 */
  51. .row2 {
  52. display: -webkit-box;
  53. overflow: hidden;
  54. text-overflow: ellipsis;
  55. word-wrap: break-word;
  56. white-space: normal !important;
  57. -webkit-line-clamp: 2;
  58. -webkit-box-orient: vertical;
  59. }
  60. /* 3行省略 */
  61. .row3 {
  62. display: -webkit-box;
  63. overflow: hidden;
  64. text-overflow: ellipsis;
  65. word-wrap: break-word;
  66. white-space: normal !important;
  67. -webkit-line-clamp: 3;
  68. -webkit-box-orient: vertical;
  69. }
  70. /* 4行省略 */
  71. .row4 {
  72. display: -webkit-box;
  73. overflow: hidden;
  74. text-overflow: ellipsis;
  75. word-wrap: break-word;
  76. white-space: normal !important;
  77. -webkit-line-clamp: 4;
  78. -webkit-box-orient: vertical;
  79. }
  80. /* 3行省略 */
  81. .row5 {
  82. display: -webkit-box;
  83. overflow: hidden;
  84. text-overflow: ellipsis;
  85. word-wrap: break-word;
  86. white-space: normal !important;
  87. -webkit-line-clamp: 5;
  88. -webkit-box-orient: vertical;
  89. }
  90. /* 3行省略 */
  91. .row6 {
  92. display: -webkit-box;
  93. overflow: hidden;
  94. text-overflow: ellipsis;
  95. word-wrap: break-word;
  96. white-space: normal !important;
  97. -webkit-line-clamp: 6;
  98. -webkit-box-orient: vertical;
  99. }
  100. /* 7行省略 */
  101. .row7 {
  102. display: -webkit-box;
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. word-wrap: break-word;
  106. white-space: normal !important;
  107. -webkit-line-clamp: 7;
  108. -webkit-box-orient: vertical;
  109. }
  110. .font15 {
  111. font-size: 0.9375rem !important;
  112. }
  113. .font18 {
  114. font-size: 1.125rem !important;
  115. }
  116. .font20 {
  117. font-size: 1.25rem !important;
  118. }
  119. .font25 {
  120. font-size: 1.5625rem !important;
  121. }
  122. /* 转大写 */
  123. .tupCass {
  124. text-transform: uppercase;
  125. }
  126. .min1200 {
  127. min-width: 1200px;
  128. }
  129. details {
  130. width: 25px !important;
  131. height: 20px !important;
  132. margin-right: 20px;
  133. }
  134. details summary {
  135. position: relative;
  136. cursor: pointer;
  137. list-style: none;
  138. width: 100%;
  139. height: 100%;
  140. }
  141. summary span {
  142. display: block;
  143. width: 100%;
  144. height: 5px;
  145. background-color: #FFFFFF;
  146. transition: 0.3s;
  147. position: absolute;
  148. }
  149. summary span:first-child {
  150. top: 0;
  151. }
  152. summary span:nth-child(2) {
  153. top: calc(50% - 2.5px);
  154. }
  155. summary span:last-child {
  156. bottom: 0;
  157. }
  158. details[open] span:nth-child(2) {
  159. display: none;
  160. }
  161. details[open] span:first-child {
  162. top: calc(50% - 2.5px);
  163. transform: rotate(-45deg);
  164. transform-origin: center;
  165. }
  166. details[open] span:last-child {
  167. bottom: calc(50% - 2.5px);
  168. transform: rotate(45deg);
  169. transform-origin: center;
  170. }
  171. header {
  172. position: relative;
  173. }
  174. datalist[open]+nav {
  175. overflow: auto;
  176. }
  177. body,html{
  178. width: 100vw;
  179. height: 100vh;
  180. background-color: #272822;
  181. }
  182. .sidbar{
  183. width: 100%;
  184. height: 100%;
  185. background: #ffc324;
  186. position: fixed;
  187. top: 0;
  188. display: flex;
  189. justify-content: center;
  190. padding-top: 100px;
  191. transition: all .5s;
  192. left: 100%;
  193. /* left: 0; */
  194. }
  195. .sidbar-avtive{
  196. left: 0;
  197. }
  198. .open{
  199. position: fixed;
  200. right: 15px;
  201. top: 15px;
  202. }
  203. .active{
  204. color: #007AFF;
  205. }
  206. .menu li{
  207. /* width: 500px; */
  208. height: 100px;
  209. overflow: hidden;
  210. border: 1px solid #000000;
  211. position: relative;
  212. color: #000000;
  213. display: flex;
  214. font-weight: bold;
  215. font-size: 7.25rem;
  216. align-items: center;
  217. justify-content: center;
  218. border-radius: 5px;
  219. /* margin-bottom: 8px; */
  220. transition: all .3s;
  221. line-height: 80px;
  222. }
  223. .menu li span{
  224. margin-top: 300px;
  225. /* transform: translateY(-150px); */
  226. }
  227. .curts{
  228. background-color: #FFFFFF;
  229. color: #000000;
  230. cursor: pointer;
  231. }
  232. /* .menu >.curts,
  233. .menu >li:hover{
  234. color: #FFFFFF;
  235. font-size: 6.875rem;
  236. cursor: pointer;
  237. } */

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/548497?site
推荐阅读
相关标签
  

闽ICP备14008679号