Открепление верхней панели ВКонтакте (VK)

Открепление верхней панели в социальной сети ВКонтакте при прокрутке страницы

当前为 2016-08-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         Открепление верхней панели ВКонтакте (VK)
// @namespace    FIX
// @version      0.8
// @description  Открепление верхней панели в социальной сети ВКонтакте при прокрутке страницы
// @author       raletag
// @include      *://vk.com/*
// @exclude      *://vk.com/notifier.php*
// @exclude      *://vk.com/*widget*.php*
// @require      https://code.jquery.com/jquery-3.1.0.min.js
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
    GM_addStyle('.headefix body .ui_search_fixed {top: 0px!important;} .headefix body .side_bar_inner{margin-top: 0px;} .headefix body .photos_period_delimiter_fixed{margin: 0px 0 0 -20px!important;} .headefix body ._audio_rows_header.audio_rows_header.fixed{top:0px!important;} .headefix body #stl_bg {padding-top: 20px!important;}');
    var ishide = false;
    if ($(window).scrollTop() > 42 && $.inArray($(location).attr('pathname'),['/im']) === -1) { // убрать панель
        $("#page_header_cont").slideUp(100);
        $('html').addClass('headefix');
        ishide = true;
        //console.log('HIDE TOP PANEL');
    }
    $(window).scroll(function() {
        if (!ishide&&$.inArray($(location).attr('pathname'),['/im']) !== -1 || $('#top_audio_player').hasClass('top_audio_player_playing')) return;
        if ($(window).scrollTop() > 42) {
            if (!ishide) { // убрать панель
                $('#page_header_cont').slideUp(100);
                $('html').addClass('headefix');
                ishide = true;
                //console.log('HIDE TOP PANEL');
            }
        } else if (ishide) { // показать панель
            $('#page_header_cont').slideDown(100);
            $('#side_bar_inner').css('margin-top','');
            $('html').removeClass('headefix');
            ishide = false;
            //console.log('SHOW TOP PANEL');
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址