0

ホバー機能はアラートを表示するために機能します....しかし、スパンタグを使用してテキストを追加することを表示できません....何が起こっているのかわかりません...以下のコードを提供します.....

$('document').ready(function () {
    window.setTimeout(function () {
        $('.cubeCell').each(function () {
            var htmlText = $(this).attr('data-text');
            $(this).append('<div class="cubeTextStyle">' + htmlText + '</div>');
            $(this).hover(

            function () {
                //alert("123");
                $(this).append($("<span> ***</span>"));
            },

            function () {
                $(this).find("span:last").remove();
            });
        });
    }, 600);
});


<div class="cubeCell"
     data-text="hover here"
     class="desktopContactImage cubeCell"
     data-caption="&lt;a style='padding-left: 40px; font-size: 14px; color: grey;' href='/Inventory/Partnumber/?ps=list' &gt;Register&lt;/a&gt; &lt;div&gt; &lt;a style='padding-left: 40px; font-size: 14px; color: grey;' href='/Bom/Bom/?ps=list' &gt;Demo&lt;/a&gt; &lt;/div&gt; &lt;a style='padding-left: 40px; font-size: 14px; color: grey;' &gt;Reports&lt;/a&gt;"
     data-image="http://intra.defie.co/images/Desktop_icons_02.07.13/guest.png"
></div>
4

1 に答える 1

0

マークアップと回転ボックスをどのように達成しているかについては (何も) よくわかりませんが、ホバー時に同じ場所にスパンを追加しているため、cubeStyleText の横にテキストを表示しようとしているのだろうかと思いますが、代わりに、ボックスの後ろに表示されます。

$(this).append($("<span> ***</span>"));

これを使って

$(this).children(".cubeTextStyle").append($("<span> ***</span>"));

それがそれである場合、それはポジショニングの問題を修正するようです.

于 2013-03-13T03:21:45.933 に答える