BootStrap使用popover外掛程式實現滑鼠經過顯示並保持顯示框,bootstrappopover

來源:互聯網
上載者:User

BootStrap使用popover外掛程式實現滑鼠經過顯示並保持顯示框,bootstrappopover

在商城裡,導覽列的購物車展示經常需要滑鼠經過時,顯示已經放入購物車的商品,bootstrap是沒有直接用的外掛程式的,這個時候就可以使用popover這個外掛程式改造後實現,具體如下:

實現:

html實現:

<a href="#" rel="drevil"><span class="glyphicon glyphicon-shopping-cart"> </span> 購物車</a>

javascript實現:

$(function(){$("[rel=drevil]").popover({trigger:'manual',placement : 'bottom', //placement of the popover. also can use top, bottom, left or righttitle : '<div style="text-align:center; color:red; text-decoration:underline; font-size:14px;"> Muah ha ha</div>', //this is the top title bar of the popover. add some basic csshtml: 'true', //needed to show html of coursecontent : '<div id="popOverBox"><img src="http://www.hd-report.com/wp-content/uploads/2008/08/mr-evil.jpg" width="251" height="201" /></div>', //this is the content of the html box. add the image here or anything you want really.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")}}, 100);});});

以上所述是小編給大家介紹的BootStrap使用popover外掛程式實現滑鼠經過顯示並保持顯示框,希望對大家有所協助,如果大家有任何疑問請給我留言,小編會及時回複大家的。在此也非常感謝大家對幫客之家網站的支援!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.