Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 国内精品久久久久久久久久影视,久青草国产视频,一区二区三区中文

          整合營銷服務商

          電腦端+手機端+微信端=數(shù)據(jù)同步管理

          免費咨詢熱線:

          “圖片滑動樣式”修改HTML教程

          友們,下午好!

          都說一張美美的圖能為文章增色三分!

          那如果是一個交互的圖片樣式 + 幾張美美圖呢?這能為文章增色多少呢?

          比如這種(樣式ID:90298)

          使用這種樣式,即能有效的展示圖片,還能縮小文章空間,而且還與讀者存在互動交互,想不想知道這種樣式怎么做出來呢?

          上面兩種樣式都可以在樣式中心輸入ID搜索到。

          但是,樣式中心的原樣式,都是四張圖片滑動的,直接進行換圖就可以使用了。

          但如果要像三兒上面做的兩個樣式,一個是5張圖,一個是9張圖,就要進HTML進行修改了。

          教程一(帶圖片說明的樣式)

          進入到“HTML”模式,找到<section .........> </section>這段代碼,先選擇Ctrl+C復制。

          然后在此段代碼結尾處敲回車鍵換行,再選擇Ctrl+V粘貼。

          粘貼幾次,樣式就會在原有四張的基礎上多出幾張,胖友們可以根據(jù)自己的需求進行多次粘貼。

          教程二

          進入到“HTML”模式,找到<img src=........./>這段代碼,先選擇Ctrl+C復制,然后在此段代碼結尾處,再Ctrl+V粘貼。

          同上個樣式,粘貼幾次,樣式就會在原有四張的基礎上多出幾張,胖友們可以根據(jù)自己的需求進行多次粘貼。

          為了樣式的美感,還是有三點建議給大家。

          1、圖片請保持尺寸一致。否則會導致圖片層次不齊。

          2、尺寸請500x500以上。否則可能會使圖片不清楚。

          3、圖片大小盡可能小點。否則瀏覽時加載會不流暢。

          更多好玩樣式,請進樣式中心搜索“滾動

          好了,本次教程就到這里~bye

          景:

          想要實現(xiàn)圖片持續(xù)滾動,既然使用js,就千萬不要加css動畫、過渡等相關樣式,如果想要滾動的平滑一下,可以一像素一像素的感動,則很平滑,如果加了過渡動畫,當圖片重置為0時,會有往回倒的動畫效果,跟預期不符。

          原理:

          圖片滾動原理同圖片輪播原理,同樣也適用于文字滾動等一系列滾動,通過復制最后一張圖片或最后一堆文字插入第一行,或復制第一張圖片或一堆文字插入在結尾,來實現(xiàn)無縫拼接,前提:1、必須是沒有設置過渡動畫的,2、重置為0的時候與當前已經(jīng)滾動到的高度對于圖片的位置而言肉眼看上去沒變化。

          實現(xiàn):

          html主要包含三塊:

          1、最外層盒子,用來展示滾動圖的區(qū)域,overflow:hidden;

          2、滾動的盒子,主要改變該盒子的定位值,來實現(xiàn)滾動,里面包含所有要滾動的圖片或文字

          3、包含圖片或文字的盒子。

          代碼:

          class Roll {

          constructor(opts) {

          this.elem = opts.elem; // 圖片包含滾動長度的元素的

          this.elemBox = opts.elemBox; //圖片展示區(qū)域元素,為了獲取展示區(qū)域的高度

          this.direction = opts.direction;

          this.time = opts.time;

          this.init();

          this.roll = this.roll.bind(this)

          this.startRoll = this.startRoll.bind(this)

          this.stopRoll = this.stopRoll.bind(this)

          }

          init(){

          this.elemHeight = this.elem.offsetHeight;

          this.elemHtml = this.elem.innerHTML;

          this.elem.innerHTML = this.elem.innerHTML + this.elemHtml+ this.elemHtml;

          this.speed;

          // 如果向上滾或者向左滾動每次減1,向下滾或者向右滾動每次加1

          if(this.direction === 'top' || this.direction === 'left'){

          this.speed = -1;

          }else{

          this.speed = 1;

          }

          }

          roll(){

          switch (this.direction) {

          case "top":

          // 如果滾動的盒子的top值超出元素的高度,則置為0

          if(Math.abs(this.elemBox.offsetTop) >= this.elemHeight){

          this.elemBox.style.top = 0;

          }else{

          this.elemBox.style.top = this.elemBox.offsetTop + this.speed + 'px';

          }

          break;

          case "bottom":

          // 如果滾動的盒子的bottom值超出元素的高度,則置為0

          if(Math.abs(this.elemBox.offsetBottom) >= this.elemHeight){

          this.elemBox.style.bottom = 0;

          }else{

          this.elemBox.style.bottom = this.elemBox.offsetBottom + this.speed + 'px';

          }

          break;

          case "left":

          // 如果滾動的盒子的left超出元素的高度,則置為0

          if(Math.abs(this.elemBox.offsetLeft) >= this.elemHeight){

          this.elemBox.style.left = 0;

          }else{

          this.elemBox.style.left = this.elemBox.offsetLeft + this.speed + 'px';

          }

          break;

          case "right":

          // 如果滾動的盒子的right超出元素的高度,則置為0

          if(Math.abs(this.elemBox.offsetRight) >= this.elemHeight){

          this.elemBox.style.right = 0;

          }else{

          this.elemBox.style.right = this.elemBox.offsetRight + this.speed + 'px';

          }

          break;

          default:

          // 默認向上滾動,如果滾動的盒子的top超出元素的高度,則置為0

          if(Math.abs(this.elemBox.offsetTop) >= this.elemHeight){

          this.elemBox.style.top = 0;

          }else{

          this.elemBox.style.top = this.elemBox.offsetTop + speed + 'px';

          }

          }

          }

          stopRoll(){

          clearInterval(this.scrollTimer)

          }

          startRoll(){

          this.scrollTimer = setInterval(this.roll,this.time)

          }

          }



          原文鏈接:https://www.php.cn/js-tutorial-448891.html


          主站蜘蛛池模板: 中文乱码字幕高清一区二区| 精品视频在线观看一区二区 | 久久综合九九亚洲一区| 精品午夜福利无人区乱码一区| 综合无码一区二区三区| 亚洲Av永久无码精品一区二区| 久久久久无码国产精品一区| 东京热无码av一区二区| 高清一区二区三区视频| 亚洲欧洲专线一区| 久久亚洲一区二区| 久久亚洲一区二区| 色狠狠AV一区二区三区| 中文字幕色AV一区二区三区| 熟女大屁股白浆一区二区| 武侠古典一区二区三区中文| 日本精品啪啪一区二区三区| 国产精品无码一区二区三区在 | 日韩电影一区二区| 国产日韩精品一区二区三区在线 | 91秒拍国产福利一区| 国产成人一区二区三区在线观看| 中文字幕一区日韩在线视频 | 久久福利一区二区| 国产精品高清一区二区三区 | 精品一区精品二区| 国产成人一区二区三区高清| 在线日韩麻豆一区| 无码日韩人妻AV一区免费l| 国产一区二区三区在线看片| 蜜桃视频一区二区三区| 中文字幕在线视频一区| 日本中文字幕一区二区有码在线| 无码国产伦一区二区三区视频 | AV天堂午夜精品一区二区三区| 无码少妇A片一区二区三区| 国产一区二区三区美女| 国产一区二区三区在线观看精品| 伊人久久精品无码av一区| 亚洲视频在线一区二区三区| 蜜臀AV无码一区二区三区|