Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

popover with trigger manual -- then toggle doesnt work #5753

Closed
Yohn opened this issue Nov 2, 2012 · 5 comments
Closed

popover with trigger manual -- then toggle doesnt work #5753

Yohn opened this issue Nov 2, 2012 · 5 comments
Labels

Comments

@Yohn
Copy link
Contributor

Yohn commented Nov 2, 2012

since I updated to 2.2.1 from 2.1.1 one of my popovers wasnt working, and I just got around to playing with it tonight and found that the toggle state for the popover isnt working correctly
heres a fiddle - http://jsfiddle.net/scK68/2/

I put in the fiddle that if you call $().popover('show') it works correctly, but when I try $().popover('toggle') it does not

I do get a javascript error being called saying
e is undefined within the tooltip source, which is pointing at this function

, toggle: function (e) {
      var self = $(e.currentTarget)[this.type](this._options).data(this.type)
      self[self.tip().hasClass('in') ? 'hide' : 'show']()
    }

maybe I'm doing it wrong, but I looked at the docs over and over again with this, and still cant figure out why the toggle switch isnt working when I call it

@w0rm
Copy link

w0rm commented Nov 2, 2012

I second that. After updating bootstrap to 2.2.1 I had to stop using toggle in favor of plain conditional call of either hide or show.

@Yohn
Copy link
Contributor Author

Yohn commented Nov 2, 2012

how were you able to find if the popover was shown or not? do a seach for that element.hasClass('in') and then hide it, else show it?

@w0rm
Copy link

w0rm commented Nov 2, 2012

Yes, this is what I do right now, check if .tip() has class in. But I'm using Popover constructor internally.

I guess you have to check element.data('popover').tip().hasClass("in") because popover doesn't provide external isOpen state check.

@Yohn
Copy link
Contributor Author

Yohn commented Nov 2, 2012

ok I think I got a fix, not sure if its the right way the bs guys would like it, but it works lol thanks for your help @w0rm

replace this

, toggle: function (e) {
      var self = $(e.currentTarget)[this.type](this._options).data(this.type)
      self[self.tip().hasClass('in') ? 'hide' : 'show']()
    }

with this in the bs file

  , toggle: function () {
        this.tip().hasClass('in') ? this.hide() : this.show()
    }

updated the fiddle to show this is working with both tooltips, and popovers
http://jsfiddle.net/scK68/4/

tkawachi pushed a commit to tkawachi/bootstrap that referenced this issue Dec 23, 2012
@Yohn Yohn closed this as completed Dec 23, 2012
@Yohn
Copy link
Contributor Author

Yohn commented Dec 23, 2012

I closed this issues since the fix has been added to the 2.3 branch

marcellodesales pushed a commit to marcellodesales/svnedge-console that referenced this issue Dec 16, 2013
* web-app/js/bootstrap-2.2.1.js
  tooltip toggle is not working. There is an issue filed:
  twbs/bootstrap#5753

  A pull request with this change is open:
  twbs/bootstrap#5768

  So hopefully, this will be fixed in next release, so we don't
  have to re-apply.


git-svn-id: https://ctf.open.collab.net/svn/repos/svnedge/trunk@3365 03e8f217-bfc6-4b7c-bcb7-0738c91e2c5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants