DIV不会低谷?

时间:2011-01-19 01:12:19

标签: javascript html css

My blog有弹出式div并且div应该是底部但是它们不会:(底部将是底部,但内容将保持不变,因此div只会延伸。

2 个答案:

答案 0 :(得分:2)

它适用于Firefox,但不适用于Chrome。 我检查了jquery代码,我可以通过两个更改来实现它:

1)为顶部的底部css属性insead设置动画 2)删除分配给bottom / top导航的表达式末尾的'px'。 更改后的脚本将是:

$(function () {
        $('.bubbleInfo').each(function () {
            var distance = 10;
            var time = 250;
            var hideDelay = 500;
            var hideDelayTimer = null;
            var beingShown = false;
            var shown = false;
            var trigger = $('.trigger', this);
            var info = $('.popup', this).css('opacity', 0);
            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;
                    info.css({
                        display: 'block'
                    }).animate({
                        bottom: '-=' + distance,
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }
                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        bottom: '-=' + distance,
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });
                }, hideDelay);
                return false;
            });
        });
    });

P.S:我验证了这一点,现在可以在Chrome和FF中使用。

答案 1 :(得分:0)

不确定这是否相关,但我在Chrome开发者工具中收到此错误:

Uncaught ReferenceError: _popupControl is not defined  http://roseannebarr.tumblr.com/:730

相关的一行是:

<script type="text/javascript">_popupControl();</script>

(调用一个确实未定义的函数)