1

私は次のものを持っています:

JS:

$(function() {
  $(".fullscreen-toggle").toggle( 
    function() {
      $("body").addClass("fullscreen");
      $(".fullscreen-toggle").wrap("<div class='fixed-container fixed-toggle' />");
      $(".new_post .wysihtml5-toolbar").wrap("<div class='fixed-container fixed-toolbar' />");
      $(".new_post .form-actions").wrap("<div class='fixed-container fixed-submit' />");
      $(this).children(".toggle-fullscreen").hide();
      $(this).children(".exit-fullscreen").show();
    },
    function() {
      $("body").removeClass("fullscreen");
      $(".new_post .fixed-container").remove();
      $(this).children(".toggle-fullscreen").show();
      $(this).children(".exit-fullscreen").hide();
    }
  );

  // Fade in/out for post fullscreen form
  $('.fullscreen .fixed-toolbar').on("mouseover", function(){
    $(this).show();
  });

HTML:

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

したがって、ユーザーがツールバーの上にマウスを置くと、ツールバーが表示されます(jQueryで動的に追加されるonため、私は使用しています)。.fullscreen .fixed-toolbarしかし、そうしても何も起こりません。

私が間違っているのは何ですか?

編集:

私はリンクで同じことを試みました、そしてそれは引き起こされました。divをホバリングしているときにそれを行う別の方法はありますか?

4

4 に答える 4

1

on間違った使い方をしていると思います。

で試してみてください

$(document).on("mouseover", '.fullscreen .fixed-toolbar', function(){
    $(this).show();
});
于 2013-01-10T08:25:04.173 に答える
1

私はあなたの問題を抱えていると思います:

$(document).on("mouseover", ".fullscreen .fixed-toolbar", function(){
    $('ul[class$="toolbar"]', this).show();
});

これを試して、役立つかどうかを確認してください。

于 2013-01-10T08:36:22.123 に答える
0

mouseoverイベントを受信するはずの要素が非表示になっているため、これは機能しません。

これを修正するには、CSSを使用して透過的なコンテンツを持つdivを作成できます。

于 2013-01-10T08:25:34.190 に答える
0

on()割り当てが評価されるとき、.fullscreen .fixed-toolbar要素がないため、何も起こりません。wrap():の直後に配置してみてください。

$(".new_post .wysihtml5-toolbar").wrap("<div class='fixed-container fixed-toolbar' />");
$('.fullscreen .fixed-toolbar').on("mouseover", function(){
    $(this).show();
});
于 2013-01-10T08:30:56.810 に答える