⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filter.lib.js

📁 asp的bbs程序
💻 JS
字号:
/*
  By Hangring
  #2007.12.20#
  ---
  use list:
  -- node.lib.js
  ---
  滤镜效果
*/

$Defined('Filter');
var Filter = {};

// 渐变
Filter.Trans = function (container /* HTMLElement */, list /* Array */, time_min /* Number */, time_max /* Number */) {
    if (! oNode.IsNode(container)) return;
    if (typeof list != 'object' || !list.length) return;

    var _container = oNode.CreateElement('div');
    container.appendChild(_container);
    with (_container.style) {
        position = 'relative';
        left = 0;
        top = 0;
        width = '100%';
        height = '100%';
    }

    container.list = [];
    for (var i = 0; i < list.length; i++) {
        var c = oNode.CreateElement('div');
        _container.appendChild(c);
        container.list.push(c);
        with (c.style) {
            position = 'absolute';
            left = 0;
            top = 0;
            width = '100%';
            height = '100%';
            textAlign = 'center';
            opacity = 0;
            filter = 'alpha(opacity=0)';
        }
        c.innerHTML = list[i];
    }

    container.current = 0;
    container.previous = 0;
    container.time_min = time_min || 100;
    container.time_max = time_max || 1000;
    container.run = function () {
        try {
            if (container.list[container.previous].filters[0].Opacity == 100) {
                container.list[container.previous].filters[0].Opacity = 0;
            }
        }
        catch (e) {
            if (container.list[container.previous].style.opacity == 1) {
                container.list[container.previous].style.opacity = 0;
            }
        }

        var cur = container.list[container.current];

        var alpha;
        try {
            alpha = cur.filters[0].Opacity + 10;
            cur.filters[0].Opacity = alpha;
        }
        catch (e) {
            alpha = parseFloat(cur.style.opacity) + 0.1;
            cur.style.opacity = alpha;
        }

        var pause = false;
        if (alpha == 1 || alpha == 100) {
            pause = true;
            container.previous = container.current;
            container.current = (container.current + 1) % container.list.length;
        }

        container.interval = setTimeout(container.run, pause ? container.time_max : container.time_min);
    };
    container.run();
};

// 滚动
Filter.Roll = function () {
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -