Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending properties for qtip or other selector plugin

I am trying to set bunch of default properties for multiple instances of qtip, but it is not working. is it possible or am I doing something wrong?

Common Properties

    var qtipDefaults = {
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'bottomLeft',
                tooltip: 'topLeft'
            }
        },
        style: {
            name: 'dark'
        }
    };

Instantiation # 1

    $('#sbt_name').qtip({
        content: 'This is the Name of the Course'
    }).extend(qtipDefaults);

Instantiation # 2

    var sbt_name = $('#sbt_name').qtip({
        content: 'This is the Name of the Course'
    });
    $.extend(sbt_name, qtipDefaults);
like image 434
SamJackSon Avatar asked Dec 09 '25 06:12

SamJackSon


1 Answers

You must prepare qtip parameters before calling qtip plugin. Try this:

$('#sbt_name').qtip($.extend(true, {}, qtipDefaults, {
    content: 'This is the Name of the Course'
}));

$.extend() merges two or more objects. true parameter indicates it will make deep copy. First object is empty, for keeping original qtipDefaults unchanged.

like image 70
nrodic Avatar answered Dec 10 '25 21:12

nrodic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!