最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Twitter Bootstrap Popover not working? - Stack Overflow

programmeradmin1浏览0评论

I have the tooltip for bootstrap working, but anytime I try and initiate the popover instead I get the error Uncaught TypeError: Cannot read property 'prototype' of undefined or Uncaught TypeError: Cannot read property 'Constructor' of undefined with the following code

 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {

    constructor: Popover

  , setContent: function () {
      var $tip = this.tip()
        , title = this.getTitle()
        , content = this.getContent()

      $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
      $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)

      $tip.removeClass('fade top bottom left right in')
    }

I am unclear of the hiccup, because I did see it working previously. Any ideas? Thanks in advance.

I have the tooltip for bootstrap working, but anytime I try and initiate the popover instead I get the error Uncaught TypeError: Cannot read property 'prototype' of undefined or Uncaught TypeError: Cannot read property 'Constructor' of undefined with the following code

 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {

    constructor: Popover

  , setContent: function () {
      var $tip = this.tip()
        , title = this.getTitle()
        , content = this.getContent()

      $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
      $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)

      $tip.removeClass('fade top bottom left right in')
    }

I am unclear of the hiccup, because I did see it working previously. Any ideas? Thanks in advance.

Share Improve this question asked Sep 3, 2013 at 18:45 triplethreat77triplethreat77 1,2968 gold badges35 silver badges70 bronze badges 6
  • Could you create a jsfiddle? – Jonathan Crowe Commented Sep 3, 2013 at 18:46
  • Unfortunately, the widget js for bootstrap is not hosted. I tried to start it at least. jsfiddle/ZrL2q/3 – triplethreat77 Commented Sep 3, 2013 at 18:57
  • Have you seen this post about extending Object.prototype? [stackoverflow./questions/10955124/… – crazymatt Commented Sep 3, 2013 at 19:56
  • @crazymatt so a previous js I'm using is breaking? I'm not doing anything out of the ordinary. – triplethreat77 Commented Sep 3, 2013 at 20:38
  • Its hard to say without seeing what code you are using. I suggest re-downloading BootStrap and getting it to work without modifying any of the code. If it doesnt work then your configuration is not set up correctly. If it does work then its probably a conflicting issue with the code you are trying to integrate it with. – crazymatt Commented Sep 3, 2013 at 21:54
 |  Show 1 more ment

2 Answers 2

Reset to default 4

I had this same issue and was able to fix it with the help of Paul Watson's ment

Make sure bootstrap-tooltip.js is included before bootstrap-popover.js

Try wrapping your call in a $(document).ready() block

ie:

$(document).ready(function() {
    $('.tipsPop').tooltip();
});
发布评论

评论列表(0)

  1. 暂无评论