亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

BootStrap自定義popover,點(diǎn)擊區(qū)域隱藏功能的實(shí)現(xiàn)

 更新時(shí)間:2018年01月23日 09:15:41   作者:lxyamxj  
下面小編就為大家分享一篇BootStrap自定義popover,點(diǎn)擊區(qū)域隱藏功能的實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

當(dāng)用bootstrap時(shí),經(jīng)常需要在某個(gè)地方添加幫助按鈕,點(diǎn)擊或者鼠標(biāo)懸浮時(shí),提示幫助信息,然而,bt給我們提供的方法里貌似沒有,如果有哪位大神知道bootstrap有的可以留言,小弟學(xué)習(xí)了:代碼如下

之前的按鈕必須定義class為pop;

$(function(){
    $(".pop").popover({placement:'right', trigger:'manual', delay: {show: 10, hide: 10}, html: true,
      title: function () {
        return $("#data-original-title").html();
      },
      content: function () {
       return $("#data-content").html(); // 把content變成html
      }});
    $('body').click(function (event) {
      var target = $(event.target);    // 判斷自己當(dāng)前點(diǎn)擊的內(nèi)容
      if (!target.hasClass('popover')
          && !target.hasClass('pop')
          && !target.hasClass('popover-content')
          && !target.hasClass('popover-title')
          && !target.hasClass('arrow')) {
        $('.pop').popover('hide');   // 當(dāng)點(diǎn)擊body的非彈出框相關(guān)的內(nèi)容的時(shí)候,關(guān)閉所有popover
      }
    });
    $(".pop").click(function (event) {
      $('.pop').popover('hide');     // 當(dāng)點(diǎn)擊一個(gè)按鈕的時(shí)候把其他的所有內(nèi)容先關(guān)閉。
      $(this).popover('toggle');     // 然后只把自己打開。
    });
  });

--------代碼非原創(chuàng),借鑒網(wǎng)上大神,純粹自己學(xué)習(xí)記錄而已,勿噴!

以上這篇BootStrap自定義popover,點(diǎn)擊區(qū)域隱藏功能的實(shí)現(xiàn)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論