2016-06-16 37 views
0

我在我的網站上有一些使用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.

+0

不幸的是我還沒有找到一個方法來殺死一個人在互聯網上,P - 在一個側面說明,一旦你的問題有一個答案,請編輯出來的問候感謝並沒有得到批准,因爲他們對未來的訪客沒有價值。無論如何,你可能會發現其他人會刪除它們。 –

+0

它有什麼特點? –

+0

當您進入畫廊部分時,該頁面在滾動後2-5秒內滾動。 – Recai

回答

0

極有可能是因爲你真的龐大的圖像 - 見下面的截圖中剛剛顯示了具有快速瀏覽你的網站與Chrome瀏覽器開發工具的結果。嘗試使用更合適的分辨率

Chrome Dev Tool Network Tab

+0

我將畫廊中圖像的分辨率更改爲更小,問題對我來說似乎保持不變。無論如何,謝謝你,減輕圖像的重量肯定會有幫助,而不是打擾。 – Recai

相關問題