Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple qtip for images in a list
14th May, 19:53 (This post was last modified: 14th May 19:54 by oneworld95.)
Post: #1
Simple qtip for images in a list
Hi. I'm using the 1.0.0-rc3 version of qtip on FF 3.6.3. I'm trying to use the title attribute from the below images to generate qtips but have had no luck:

JS Code
<ul class="flatList social-footer" id="social">
  <li><img src="global/img/icons/social_24/facebook.png" width="24" height="24" class="glow" title="Share on Facebook"
      />
        </li>
    <li ><img src="global/img/icons/social_24/twitter.png" width="24" height="24" class="glow" title="Share on Twitter" />
 
    </li>
    <li ><img src="global/img/icons/social_24/youtube.png" width="24" height="24" class="glow" title="Share on YouTube"/>
      </li>
    <li ><img src="global/img/icons/social_24/flickr.png" width="24" height="24" class="glow" title="Share on Flickr"/>
 
    </li>
</ul>


Here's what I've tried:

JS Code
$(document).ready(function(){
	   $('#social li img[title]').each(function()
	   {
		  $(this).qtip({
			 content: $(this).attr('title'), // Use the tooltip attribute of the element for the content
			 style: 'light' // Give it a crea mstyle to make it stand out
           });
	   });
});


It keeps giving this error:

JS Code
Error: f(this).data("qtip") is null
Source File: http://localhost/cms/global/js/qtip/jquery.qtip-1.0.0-rc3.min.js
Line: 15

What am I doing wrong? Thanks.
Find all posts by this user
Quote this message in a reply
15th May, 13:39
Post: #2
RE: Simple qtip for images in a list
oneworld, you don't need to specify the title as teh content as this is done as a fallback anyway:

JS Code
$(document).ready(function(){
      $('#social li img[title]').qtip({
          style: 'light' // Give it a crea mstyle to make it stand out
      });
});

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
25th March, 19:29
Post: #3
RE: Simple qtip for images in a list
So how would you expand this to have the qtip show an enlarged image + some html code instead of the usual small text provided in a tltle or alt of an image attribute?
Find all posts by this user
Quote this message in a reply
25th March, 19:57
Post: #4
RE: Simple qtip for images in a list
Once I need more than basic text, I usually go with hidden elements (eg. a SPAN or DIV). But you can put HTML in the title/alt tag and it works as well:
JS Code
<p>
	<a class="trigger" href="#" title="<img src='/path/to/image.jpg' width='100%' /><br >Some <b>more</b> HTML.">Trigger</a>
</p>
Working demo:

http://jsfiddle.net/kiddailey/q5vFh/

Edit: Sorry for the invalid "br" tag, but the forum software strips it out if I use a self-closing tag even in the code block :/
Find all posts by this user
Quote this message in a reply
26th March, 19:22
Post: #5
RE: Simple qtip for images in a list
Thanks for the nice working example.

Now the image example I am having a problem having the image QTIP to align properly.


So if the image is [HERE] and say its 75x75 pixels, the qtip is aligning at the very bottom right of the image and the position is being done on 'event'.

Any idea how to have the qtip pointing to the left, positioned to the right of the image and center dead in the middle so 36 pixels from the top of the image and 36 pixel from the bottom?
Find all posts by this user
Quote this message in a reply
27th March, 03:34
Post: #6
RE: Simple qtip for images in a list
The positioning documentation will probably answer that question for you:

http://craigsworks.com/projects/qtip/doc.../#position
Find all posts by this user
Quote this message in a reply
27th March, 13:18
Post: #7
RE: Simple qtip for images in a list
(27th March 03:34)kiddailey Wrote:  The positioning documentation will probably answer that question for you:

http://craigsworks.com/projects/qtip/doc.../#position

That part I can get, the pointer/arrow in the popup. But the popup is below the image..
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Solved] Different images for each tooltip popup - tables ityler 1 126 12th April 15:41
Last Post: Craig
  stuck qTip on images in tablerow ulktante 0 422 6th December 08:32
Last Post: ulktante
  [Solved] simple test won't work? formaideale 3 536 11th October 12:48
Last Post: Craig
  [Solved] error: missing}after property list captamirul@yahoo.com 8 1,329 10th September 15:22
Last Post: Craig
  Simple working example? PeterY 2 954 7th August 20:18
Last Post: kiddailey
  very simple working example? solitario 3 2,634 7th August 20:16
Last Post: kiddailey
  qtip for dynamic images & content cooldeeps 2 1,192 6th May 16:30
Last Post: cooldeeps
  [Solved] Should be simple question gtppopzz 9 1,128 24th January 18:54
Last Post: Craig
  [Solved] Simple example not working - I'm missing something obvious sunnyday 6 1,296 6th January 03:33
Last Post: Craig
  qTip appearing below list item soap_box 3 882 3rd December 13:32
Last Post: Yann39



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