-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Tooltip conflict with jQuery UI #6303
Comments
@billmn Can you provide more details about what the conflict is? |
@tnorthcutt That tooltip function no longer works. jQuery UI tooltip ( http://jqueryui.com/tooltip/ ) overwrite the Bootstrap tooltip because, I think, use the same namespace and same function name |
I believe the bootstrap guys put in a no conflict clause in the current version of bootstrap that should fix this |
noConflict was added in a7eb9c2 |
@meleyal Can you explain me how to use noConflict? I've tried to use the example from the docs ( http://twitter.github.com/bootstrap/javascript.html ) : var bootstrapButton = $.fn.button.noConflict() $.fn.bootstrapBtn = bootstrapButton but I get : TypeError: $.fn.button.noConflict is not a function I've checked into bootstrap.min.js and there is : ... $.fn.button.noConflict=function(){return $.fn.button=old,this} ... Why? What did I do wrong? |
Try this, the last log of |
Yeah ... the first I've to run this before including jQuery UI to solve the problem? var bootstrapButton = $.fn.button.noConflict(); $.fn.bootstrapBtn = bootstrapButton; var bootstrapTooltip = $.fn.tooltip.noConflict(); $.fn.bootstrapTlp = bootstrapTooltip; Is it the right way? |
Include jquery-ui first, then bootstrap, then the noConflict code. |
I've tried this : http://jsfiddle.net/nwX2E/ Now I can have tooltip functions (Bootstrap and jQuery UI) but var bootstrapTooltip = $.fn.tooltip.noConflict(); $.fn.bstooltip = bootstrapTooltip; // bootstrapTooltip => Bootstrap; $.fn.tooltip => jQuery UI Tooltip console.log(bootstrapTooltip, $.fn.tooltip); $('#example').bstooltip(); |
+1 |
Any news about that? |
I couldn't use Bootstrap's noConflict() method. What I did was downloading and using custom package of jQuery UI which doesn't have tooltips in it. That's not perfect because I'm using PHP Framework and I was needed to override using in-built copy with the custom one. |
Sure I've used this method too ... But it's not the best thing. :) |
After fighting with it for a while. I'm coming to the conclusion that the bootstrap tooltip noConflict doesn't work :( Was it ever tested? Using the noConflict method to rename the bootstrap tooltip function causes the tooltip code to throw a lot of errors. I have found a variety of reasons for this, although I don't think I've found them all.
I feel like if I stare at this long enough I'll be able to untangle it and make the noConflict usable, but since I didn't write it and there's little documentation in the code, I am struggling. My original problem is that we are using jquery tools which has its own tooltip method and the two don't play nice despite the attempt to add an ineffectual noConflict method. If someone can help me understand what's happening on lines 75 and 82, and why they are necessary instead of just pulling either data from the element, or using the Tooltip objects built in options property, I might be able to unravel this a little more. Hope my thoughts were helpful. Thanks, |
As you can see above, I created a patch to get the noConflict method working. Since the plugin does a lot of looking at the $.fn.tooltip, I had to change the noConflict method to specify the new name so the plugin code would know where to look and what to load. It's a little bit hacky, but it works. I've done a pull request, but if you need it sooner you can get it from my fork. |
It should be noted that jQuery UI also provides a simple workaround via $.widget.bridge(): // handle jQuery plugin naming conflict between jQuery UI and Bootstrap
$.widget.bridge('uibutton', $.ui.button);
$.widget.bridge('uitooltip', $.ui.tooltip); |
Very cool! As I said in my first post, my issue is with jquery tools. I know this issue was originally with jquery ui, but my patch solves conflicts with any other .tooltip plugin. |
yeah tooltip noconflict is currently broke – for now id' just use the jquery bridge which seems to be working. I'm going to wait to fix this noconflict issue for 3.0 because it will require a bit of a refactor and i don't want to stress about backwards compatibility, thanks |
Is this considered fixed? I am getting
on lines 107, 122 when trying to use tooltip noconflicted and not sure if it's me doing it wrong (sorry, not good at JS) or it was never resolved in 3.0 as planned. |
Same here: ... has no method 'noConflict' Bootstrap 3.0 |
@svscorp Works fine for me http://jsfiddle.net/24TPJ/ |
If I understand your fiddle it demonstrates that What is broken is trying to use |
@Rarst To function properly, |
Yes, I have been trying latter and shoot me I cannot make it work in my code (getting above mentioned error). My code is along: jQuery(document).ready(function () {
jQuery.fn.lapstooltip = jQuery.fn.tooltip.noConflict();
jQuery(".laps-timeline .event").lapstooltip({
container: '#wpadminbar', placement: 'bottom', html: true
});
}); |
And you get the following error message?
|
Yes, on lines 107 and 122 of Does it matter that I am loading |
Which exact version of |
Trying with 3.0.3 right now. jQuery 1.10.2 (noconflicted), jQuery Migrate 1.2.1 |
Could you try and replace the content of your |
Error changed to:
I am going to try starting with empty html and add stuff step by step... |
Here is live example with nothing else in it http://www.rarst.net/tooltip.xhtml I can't make sense why/how fiddle works, but not this. |
Well, first of all, you are missing the Bootstrap CSS in your example. |
Done and done. PS now having power blackout, so world is definitely conspiring hard against me on this. :) |
Oh, of course, how could I be this blind 😃 So what it's doing is: $(obj.currentTarget)[this.type]() which equals (in the case of a tooltip) $(obj.currentTarget).tooltip() even though I could do a PR on this but maybe @fat or someone else from the team wants to handle this, as it is a rather delicate topic. |
I hadn't got much of what you said :), but I think it can be concluded:
Thank you for your help and hope to see this resolved! So far I had to settle for editing script to have it occupy non-generic name. |
Does exists a method to avoid the conflict between Bootstrap's Tooltips and jQuery UI Tooltip method?
I know that I can download jQuery UI without the tooltip component ... but if I would have this component too ... is possible to have tooltips working together?
Bootstrap 2.2.2
jQuery UI 1.9.2
( sorry for the bad english :-) )
The text was updated successfully, but these errors were encountered: