1

以下のスニペットでは、IIFE init() は呼び出されません。必要に応じて、他のコードを投稿できます。

これはドロップダウンメニュー用です。私はテストしている$Frame.Support()ので、これが何か関係があると確信しています。または、メソッドの引数になるようにコード構造を変更した方法です。

$Frame.Support({
    name: 'Menu',
    body: function () {
        var top_element = $A("#hold_name")[0],
            bottom_element = $A("#wrap_bottom")[0],
            time_out_id = 0,
            TIME_DELAY = 1000;

        function top_mouse_over() {
            window.clearTimeout(time_out_id);
            bottom_element.style.visibility = 'visible';
        }
        function bottom_mouse_over() {
            window.clearTimeout(time_out_id);
        }
        function mouse_out() {
            time_out_id = window.setTimeout(function () {
                bottom_element.style.visibility = 'hidden';
            }, TIME_DELAY);
        }

        (function init() {
            alert('I can\'t see me.');
            top_element.addEventListener("mouseover", top_mouse_over, false);
            top_element.addEventListener("mouseout", mouse_out, false);
            bottom_element.addEventListener("mouseover", bottom_mouse_over, false);
            bottom_element.addEventListener("mouseout", mouse_out, false);
        }());
    }
});
4

0 に答える 0