亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

替換html后重新加載flickity

替換html后重新加載flickity

Helenr 2023-10-24 15:51:53
我運行了多個 flickity,它在第一個 html 代碼中正確運行。雖然單擊按鈕后.boxgallery替換為新的 html .boxgallery,但運行 flickity 并不正確。我該怎么辦?(不變的replaceWith js)var $carousel = $('.gallery').flickity();var isFlickity = true;$('.button').on( 'click', function(){    //Clearing previous contents    $carousel.flickity('destroy');      $('.boxgallery').replaceWith('<div class="boxgallery"><div class="gallery"><div class="gallery-cell"></div><div class="gallery-cell"></div><div class="gallery-cell"></div></div></div>');    // init new Flickity    $carousel.flickity();});@import url(http://flickity.metafizzy.co/flickity.css);* {  box-sizing: border-box;}body {  font-family: sans-serif;}.gallery {    width: 200px;    background: #FAFAFA;    margin-bottom: 30px;    counter-reset: gallery-cell;    float: right;    margin: 10px;}.gallery-cell {  width: 100%;  height: 160px;  margin-right: 20px;  background: #8C8;  counter-increment: gallery-cell;}.gallery-cell:before {  content: counter(gallery-cell);  display: block;  text-align: center;  line-height: 160px;  font-size: 80px;  font-weight: bold;  color: white;}.gallery-nav {  list-style: none;  margin: 0;  padding: 0;}.gallery-nav li {  display: inline-block;  font-size: 20px;  color: #09F;  border: 1px solid;  padding: 10px;  margin-right: 5px;}.gallery-nav li.is-selected {  background: #09F;  color: white;}.gallery-nav li:hover {  background: #ADF;  cursor: pointer;}
查看完整描述

1 回答

?
慕仙森

TA貢獻1827條經驗 獲得超8個贊

我認為您最好使用調整大小


查看完整回答
反對 回復 2023-10-24
  • 1 回答
  • 0 關注
  • 106 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號