2

奇妙なもの:私のサイトでは、位置は機能しますが、マウスオーバーとz-indexは機能しません。フィドルでは、マウスオーバーは機能しますが、位置は機能しません。

jQueryが選択できなくなる原因となるCSS設定が欠落していますか?

私はそれがただ悪いコードか私が知らないニュアンスであることを望んでいます。

よろしくお願いします!

html

<div style="text-align: center; position: relative">
    <span id="selectSupplierNameSpan" style="z-index:100">
        Vendor
    </span>
    <div id="selectSupplierNameContainer" style="position: absolute; opacity: 0; z-index:50">
        <input type="text" id="selectSupplierName" ></input>
    </div>
</div>​

jQuery

$("#selectSupplierNameContainer").position({
    my: "center",
    at: "center",
    of: $("#selectSupplierNameSpan"),
});

$("#selectSupplierNameSpan").mouseover(function() {
    var thisHeight = $("#selectSupplierNameContainer").height();
    $("#selectSupplierNameContainer").animate({
        opacity: 1,
        top: "+=" + thisHeight
    }, 500);
});​

http://jsfiddle.net/7s4VN/10/

編集

jquery 1.7.2に移動し、ui 1.18を追加しましたが、マウスオーバーが機能しなくなりました。

4

1 に答える 1

2

z-index配置された要素にのみ適用できます。position:relative;のスタイルに追加すると、<span>正常に機能します。

http://jsfiddle.net/mblase75/7s4VN/11/

于 2012-10-19T14:07:24.847 に答える