Bootstrap 鼠標懸停顯示

html代碼

<button type="button" rel="drevil" data-content="報名截止時間:'+time+'" data-container="body" data-toggle="popover" data-placement="bottom"></button>

JS代碼

$(function () { $("[data-toggle='popover']").popover(); }); 

$("[rel=drevil]").popover({
                      trigger:'manual',
                      html: 'true', //needed to show html of course
                      animation: false
                  }).on("mouseenter", function () {
                      var _this = this;
                      $(this).popover("show");
                      $(this).siblings(".popover").on("mouseleave", function () {
                          $(_this).popover('hide');
                      });
                  }).on("mouseleave", function () {
                      var _this = this;
                      setTimeout(function () {
                          if (!$(".popover:hover").length) {
                              $(_this).popover("hide")
                          }
                      }, 300);
                  });

來自原文地址

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章