我在我的網站上有一些使用jQuery製作的選項卡式圖庫。 當我嘗試在活動圖像選項卡的圖庫部分中滾動頁面時,滾動確實很滯後。
你可以請嘗試幫我解決這個問題嗎? 下面的代碼的一部分,其負責標籤庫:
HTML(玉):
使用選項卡式內容滾動頁面
article.content-box.gallery#osom
ul#homepagetabs.gallerytabs(data-tabs="tabset1")
li.tabs#tab7(data-tab="t1")(style="background-image: url('http://static1.gamespot.com/uploads/original/1551/15511094/3066900-legends-1940x1095.png')")
#tabset1.gallery
#t1.tab.is-acive.current(style="background-image: url('http://fastup.pl/data/Aueternum/Rzeczy%20cyca/maxresdefault.jpg')")
CSS(筆):
.tab
display none
animation: animacja
animation-duration: .3s
animation-iteration-count: 1
animation-timing-function: ease-in-out
animation-fill-mode: both
&.is-active
display block
width: 100%
height: 85vh
background-position: center
background-size: cover
border: 5px solid $pink
.gallerytabs
display: flex
margin: 0
padding: 0
align-items: center
width: 100%
.tabs
flex: 1
height: 70px
margin: 25px 5px
background-position: center
background-size: cover
border: 1px solid $pure-pink
filter: grayscale(100%)
transition: 0.3s ease-in-out
position relative
z-index 1
&:hover
filter: none
cursor: pointer
&.is-active
filter: none
.gallery
width: 100%
height: 100vh
JS(jQuery的)
$('[data-tab]').on('click', function() {
var $btn = $(this).attr('data-tab');
var $wrapper = $(this).parent().attr('data-tabs');
var activeClass = 'is-active';
$('[data-tabs='+$wrapper+']'+' [data-tab]').removeClass(activeClass);
$('[id='+$wrapper+']'+' .tab').removeClass(activeClass);
$(this).addClass(activeClass);
$('[id='+$btn+']').addClass(activeClass);
});
Here you have the page to see the laggy effect.
不幸的是我還沒有找到一個方法來殺死一個人在互聯網上,P - 在一個側面說明,一旦你的問題有一個答案,請編輯出來的問候感謝並沒有得到批准,因爲他們對未來的訪客沒有價值。無論如何,你可能會發現其他人會刪除它們。 –
它有什麼特點? –
當您進入畫廊部分時,該頁面在滾動後2-5秒內滾動。 – Recai