0

自動YUIオートコンプリートzindexがオフになっています。オートコンプリートDIVを一番上に強制するにはどうすればよいですか。

ここに画像の説明を入力してください

以下では、YUIの標準テンプレートを使用しています。

YAHOO.util.Event.onDOMReady(function(){YUI()。use( "autocomplete"、 "autocomplete-filters"、 "autocomplete-highlighters"、function(Y){var inputNode = Y.one('#name' )、tags = ['css'、'css3'、'douglas crockford'、'ecmascript'、'html'、'html5'、'java'、'javascript'、'json'、'node.js'、'pie '、' yui']、lastValue ='';

        inputNode.plug(Y.Plugin.AutoComplete, {
                activateFirstItem: true,
                minQueryLength: 0,
                queryDelay: 0,
                source: tags,
                resultHighlighter: 'startsWith',
                resultFilters: ['startsWith']
        });

        // When the input node receives focus, send an empty query to display the full
        // list of tag suggestions.
        inputNode.on('focus', function () {
                inputNode.ac.sendRequest('');
        });

        // When there are new AutoComplete results, check the length of the result
        // list. A length of zero means the value isn't in the list, so reset it to
        // the last known good value.
        inputNode.ac.on('results', function (e) {
                if (e.results.length) {
                        lastValue = inputNode.ac.get('value');
                } else {
                        inputNode.set('value', lastValue);
                }
        });

        // Update the last known good value after a selection is made.
        inputNode.ac.after('select', function (e) {
                lastValue = e.result.text;
        });
});

});

4

1 に答える 1

1

単にcssにz-indexを入れるだけです。以前はJSを介した設定が許可されていましたが、YUI 3.4.0では、cssのみのフラグ(https://github.com/yui/yui3/blob/master/src/autocomplete/HISTORY.md)になっています。

関連するCSSは次のとおりです(必要に応じてz-indexを調整します)。

.yui3-aclist { z-index: 100; }

PS。、あなたのYAHOO。行はYUI2からのものであるため、これは非常に独特であり、標準のテンプレートではありません。

YUI()。use(...)セクションのコールバックが呼び出されるまでに、domの準備ができているはずです。オンドムレディは必要ありません。

于 2012-09-01T20:18:50.317 に答える