Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qTip Dynamic Width

I am currently using qTip jQuery plugin in combination with Full Calendar. Both of these works great. However, I am currently stuck at an issue.

Sometimes, my qTip content has to much data. This gets clipped of as the width and height of the qTip tooltip is fixed. Is there any way I can make the width and height dynamic?

I found that the maximum width is 350 but this is not enough for my requirement.

like image 505
RajeshShah Avatar asked Oct 01 '12 11:10

RajeshShah


3 Answers

If you don't want to modify the qtip source simply add this in your css

.qtip { max-width: none !important; }

With this css hack the tip will adapt to the content you write inside.

If you want to put a fixed size change the none to the size you need (example: 500px).

like image 114
NetVicious Avatar answered Jan 03 '23 14:01

NetVicious


What I did is creating my own class/style.

In HTML page

jQuery("#tooltip").qtip({ 
    content: {    
         text : "tooltip", 
         title:{ text: "Row Information", button: 'Close'}
    }, 
    style: {classes: "MyQtip"},
    show: {solo: true},
    hide: false
});

In my CSS, I have

.MyQtip {max-width: 1000px}
like image 27
Tony Avatar answered Jan 03 '23 15:01

Tony


I bumped into the same problem.

In qtip.css , you can change max-width :

.qtip{
    max-width: 460px;
}

And whenever you want to use it:

var widthValue = '280px';
if ( someothercondition == true ) { widthValue = '480px'; }    

jQuery("#tooltip").qtip({ 
    content:{    
        text : "tooltip", 
        title:{ 
            text: "Row Information",
            button: 'Close'
        }
    }, 
    style: {
        width: widthValue 
    },
    show:{
        solo: true
    },
    hide: false
});
like image 38
user583726 Avatar answered Jan 03 '23 16:01

user583726