Pass options through data- attributes
See original GitHub issueHi,
I love the plugin and started using it in my project, but I have to use wrap it’s usage in another plugin.
/**!
* Tooltips
* Wraps the call to load jquery.tooltipster.js
* so that we can pass special configs on a case by case basis
*/
$.fn.tooltips = function() {
// To chain body plugins
return this.each(function() {
$('.tooltip').each(function(){
var $el = $(this);
$el.tooltipster({
speed: $el.data('tooltipspeed') || 0,
position: $el.data('tooltipposition') || 'top',
trigger: $el.data('tooltiptrigger') || 'hover',
contentAsHTML: $el.data('tooltiphtml') || false,
interactive: $el.data('tooltipinteractive') || false,
delay: 0,
theme: 'tooltipster-light'
});
});
});
};
Any plans to allow setting options through data attributes so they can be set on a case by case basis? Thanks
Issue Analytics
- State:
- Created 10 years ago
- Comments:11
Top Results From Across the Web
Passing selected option to method and access data attributes
Wiring up an event handler and getting the user's selection and even accessing the data attributes within the event handler is fine. <script>...
Read more >Using data attributes - Learn web development | MDN
To get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that...
Read more >HTML option data-* Attribute - Dofactory
An <option> element can have any number of data-* attributes, each with their own name. Using data-* attributes reduces the need for requests...
Read more >A Complete Guide to Data Attributes | CSS-Tricks
Everything you ever wanted to know about data attributes in HTML, CSS, and JavaScript.
Read more >data-* attributes - The jQuery replacement for select boxes
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Although this will not be included in Tootlipster directly, there is nothing easier than to implement it. I’ve even included an example of it in the documentation of V4 (on the v4 branch) and it will also be available as a plugin for Tooltipster. Here is the snippet for V4:
and for v3 (not tested, let me know if it’s ok):
+1
Do you know a good alternative tooltip plugin with this feature?