Code Monkey home page Code Monkey logo

Comments (2)

calebjacob avatar calebjacob commented on August 21, 2024

Since Tooltipster is built on one of the most recommended plugin structures (http://jqueryboilerplate.com/), using the exact same method that qTip uses won't be possible. One of the biggest benefits to the way Tooltipster is set up is the ability to change options on only one specific tooltip. A unique Tooltipster object is attached to each element with its own set of options. So in order to change multiple properties of all your tooltips at once, this is how you'd need to do it:

$('.tooltip').each(function() {
var currentOptions = $(this).data('plugin_tooltipster').options;
$(this).data('plugin_tooltipster').options = $.extend(true, {}, currentOptions, {
position: 'bottom',
speed: 1000
});
});

Or if you wish to change multiple options on just one tooltip:

var currentOptions = $('#my-tooltip').data('plugin_tooltipster').options;
$('#my-tooltip').data('plugin_tooltipster').options = $.extend(true, {}, currentOptions, {
position: 'bottom',
speed: 1000
});

It is slightly more code - but the benefit of being able to change just one tooltip without affecting the other tooltips makes it worth it.

from tooltipster.

sparky672 avatar sparky672 commented on August 21, 2024

Thank-you! It's not a problem. I'm just using jQuery .extend() to keep different "sets" of options and then I combine them as needed.

var ttvDef = {
trigger: 'custom',
onlyOne: false,
animation: 'grow'
},
ttvOpt1 = {
position: 'top'
},
ttvOpt2 = {
position: 'bottom',
offsetX: 110
};
$.extend(ttvOpt1, ttvDef);
$('input[name_="name"]').tooltipster(ttvOpt1);
$.extend(ttvOpt2, ttvDef);
$('input[name_="email"]').tooltipster(ttvOpt2);

from tooltipster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.