Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Dynamic value in content of qtip
12th May, 05:51 (This post was last modified: 12th May 05:53 by shadabrd.)
Post: #1
[Solved] Dynamic value in content of qtip
i have used the qtip and i have to enter the dynamic value in qtip not with ajax.
my code is as follows.

JS Code
var value = <?php echo $value; ?>
$("#username").qtip({
 
            content: { text:"want to display value here"},
            show:{ when : {event: 'focus'} },
            hide: { when: { event: 'blur' } },
            position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle '} },
            style: { name: 'light', border: { width: 3, radius: 8, color: '#CCEEFF' }, width: 300,
            tip: { corner: 'leftMiddle', color: '#CCEEFF', size: { x: 20, y: 8} }
            }
         })
Find all posts by this user
Quote this message in a reply
14th September, 02:06
Post: #2
RE: Dynamic value in content of qtip
This is what I have done here, where another plugin creates the
JS Code
<div class="error-tooltip"></div>


JS Code
$("td").qtip({
				style: { 
					name: 'red', // Inherit from preset style
					tip: 'bottomLeft'
				},
				position: {
				  corner: {
					 target: 'rightMiddle',
					 tooltip: 'bottomLeft'
				  }
			    },
				api: {
					beforeShow: function() {
						var content = this.elements.target.children(".error-tooltip");
						if(content.length > 0) {
							this.updateContent(content.html());
							return true;
						}
						else {
							return false;
						}
					}
				}
			});


Check this line here:
JS Code
var content = this.elements.target.children(".error-tooltip");
Find all posts by this user
Quote this message in a reply
16th September, 14:31
Post: #3
RE: Dynamic value in content of qtip
You can also use an .eacH() loop to prevent having to use the beforeShow API:

JS Code
$("td").each(function() {
   var content = $(this).children(".error-tooltip");
   $(this).qtip({
            content: content,
            style: { 
               name: 'red', // Inherit from preset style
               tip: 'bottomLeft'
            },
            position: {
              corner: {
                target: 'rightMiddle',
                tooltip: 'bottomLeft'
              }
             }
         });
});

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] Dynamic parameter not working modal tooltip bssehra 1 471 25th August 18:22
Last Post: Craig
  qTip for Dynamic Content with Ajax Call hariprasadrj 1 2,588 1st May 22:24
Last Post: Craig



User(s) browsing this thread: 1 Guest(s)