1

私は内部サイトで作業しており、Google の API を外部呼び出して setOnLoadCallback() 関数を使用することはできず、ローカルで呼び出された JQuery で使用できる純粋な JQuery の代替手段が見つからないようです。参考までに、実装しようとしているコードは次のとおりですが、元の開発者は Google API を使用して記述しています。

<script type="text/javascript">

  google.load("jquery", "1.3.2");

  google.load("jqueryui", "1.7.2");



  google.setOnLoadCallback(function() { 

    var timeout = null;

    var initialMargin = parseInt($("#siteMenuBar").css("margin-top"));



    $("#siteMenuBar").hover(

        function() {

            if (timeout) {

                clearTimeout(timeout);

                timeout = null;

            }

            $(this).animate({ marginTop: 0 }, 'fast');

        },

        function() {

            var menuBar = $(this);

            timeout = setTimeout(function() {

                timeout = null;

                menuBar.animate({ marginTop: initialMargin }, 'slow');

            }, 1000);

        }

    );

  });

</script>

任意の提案/アイデアをいただければ幸いです。

4

1 に答える 1

6

必要なのは交換だけだと思います

google.setOnLoadCallback(function() { 

$(document).ready(function() {

これが役立つことを願っています!

于 2011-11-11T16:27:27.230 に答える