1

我主要不是 jquery 或 javascript 程序员,可能有更有效的方法来实现这一点,但最终我在 Firefox 中调试脚本失败 8 秒后。

在命令提示符附近悬停会触发 jquery 脚本 .hover 事件,该事件会启动 jquery 动画精灵。

在除 FireFox 之外的所有浏览器中都能正常工作。在开始失败之前,它将集体播放 8 秒。这是 4 个区域/脚本中的每一个的累积值。

有没有办法修改这个脚本来调试它?

(下面的脚本是四个象限之一的摘录。所有使用的脚本暂时都内联在索引中,为了方便调试,只需访问 url 即可查看整个 she-bang)

        <script type='text/javascript'>

        /* timer functions */
        var intvalBR="";
        function setIntBR(){if(intvalBR===""){
                  intvalBR=window.setInterval("BR()",100);
              }else{
                  stop_IntBR();
              }
            }   

        /* timer reset functions */
        function stop_IntBR(){
                if(intvalBR!==""){
                  window.clearInterval(intvalBR);
                  intvalBR="";

              }
            }

        /* background reset functions */
        function resetBotRight(){
            $("#bottom-right").css({'background-position': '0px 0px'});
        }

        // first frame of animation
        var frame = 1;
        function BR()
        {
                var left = 400 * frame;
                // top stays 0 since all the images are have Y positioned at  0
                var top = 0;


                $('#bottom-right').css('backgroundPosition','-'+left+'px -'+top+'px');

                frame++;
        }

            $("#bottom-right-inside").hover(function(){
                $("#bottom-right-inside").addClass("bottom-right-inside");      
                setIntBR();         
            },
            function(){
                $("#bottom-right-inside").removeClass("bottom-right-inside");
                stop_IntBR();
                resetBotRight();

            });     

        });
            </script>
4

0 回答 0