footer2078

Dynamic backgrounf for a footer

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/491234/1351460/footer2078.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

$(document).ready(function () {
    $('.brand').hover(function () {
        var dynamicBgHeight;

        if ($(this).find('.fa-microsoft').length > 0) {
            dynamicBgHeight = 410;
        } else if ($(this).find('.fa-apple').length > 0) {
            dynamicBgHeight = 250;
        } else if ($(this).find('.fa-linkedin').length > 0) {
            dynamicBgHeight = 370;
        } else if ($(this).find('.fa-discord').length > 0) {
            dynamicBgHeight = 330;
        } else if ($(this).find('.fa-facebook').length > 0) {
            dynamicBgHeight = 370;
        } else if ($(this).find('.fa-twitter').length > 0) {
            dynamicBgHeight = 330;
        } else if ($(this).find('.fa-google').length > 0) {
            dynamicBgHeight = 290;
        } else if ($(this).find('.fa-telegram').length > 0) {
            dynamicBgHeight = 370;
        } else if ($(this).find('.fa-paypal').length > 0) {
            dynamicBgHeight = 300;
        }

        if ($(this).find('.dynamic-background').length === 0) {
            var dynamicBg = $('<div class="dynamic-background"></div>').css({
                'position': 'absolute',
                'border-radius': '5px',
                'bottom': '0',
                'left': '0',
                'width': '35px',
                'height': '0',
                'background-color': 'rgba(0, 0, 0, 0.5)',
                'z-index': '-1',
                'transition': 'height 0.3s ease'
            });
            $(this).prepend(dynamicBg);
        }

        $(this).find('.dynamic-background').css('height', dynamicBgHeight + 'px');

    }, function () {
        $(this).find('.dynamic-background').css('height', '0');
    });
});