Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] styling tooltips with an image map
12th August, 17:10
Post: #1
styling tooltips with an image map
qTip is great and I absolutely love it, thank you for creating such a great tool.

I'm having a styling problem. I have a color-coded image map and I have qtip working perfectly. My problem is that I want to have color-coded tooltips on my image map. Right now I can only get one style to work for all of them.

I don't know how to apply separate styles to separate areas of my map.

Please help. I need the syntax, where do I call the new style?
Find all posts by this user
Quote this message in a reply
12th August, 17:54
Post: #2
[Solved] styling tooltips with an image map
nataroo, could you provide the code your using so I can advise you on the best method please?

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
12th August, 18:30
Post: #3
styling tooltips with an image map
Yes sure Craig! Thank you for the quick reply.

Here is the j
JS Code
<script class="example" type="text/javascript"> 
// Create the tooltips only when document ready
$(document).ready(function()
{
   // Use the each() method to gain access to each elements attributes
   $('area').each(function()
   {
      $(this).qtip(
      {
         content: $(this).attr('alt'), // Use the ALT attribute of the area map
         style: {
            name: 'light', // Give it the preset dark style
            border: {
               width: 0, 
 
               radius: 4 
            }, 
            tip: true // Apply a tip at the default tooltip corner
         },
        position: {
      corner: {
         target: 'rightMiddle',
         tooltip: 'leftMiddle'
      }
     }
 
      });
   });
});
</script>


Here is the image map (HTML):

JS Code
<img src="images/reform/FudingReform.jpg" alt="" width="551" height="333" border="0" usemap="#reform" class="left" />
  <map name="reform" id="reform">
 
<area shape="rect" coords="4,31,273,91" o<strong></strong>nmouseover="this.alt='';showtip('my tooltip')" o<strong></strong>nmouseout="hidetip()" alt="lorem ipsum"/>
 
<area shape="rect" coords="4,94,272,150" o<strong></strong>nmouseover="this.alt='';showtip('my tooltip')" o<strong></strong>nmouseout="hidetip()"  alt="lorem ipsum " />
 
<area shape="rect" coords="4,151,274,209" o<strong></strong>nmouseover="this.alt='';showtip('my tooltip')" o<strong></strong>nmouseout="hidetip()"  alt="lorem ipsum" />
 
<area shape="rect" coords="4,211,275,273" o<strong></strong>nmouseover="this.alt='';showtip('my tooltip')" o<strong></strong>nmouseout="hidetip()"  alt="lorem ipsum" />
 
<area shape="rect" coords="4,274,273,335" o<strong></strong>nmouseover="this.alt='';showtip('my tooltip')" o<strong></strong>nmouseout="hidetip()" alt="lorem ipsum" </strong>" />
</map>
Find all posts by this user
Quote this message in a reply
13th August, 12:21
Post: #4
styling tooltips with an image map
I'd recommend using a custom HTML attribute on your elements to specify the style of the tooltip in this case. For example:
JS Code
<area shape="rect" coords="4,274,273,335" o<strong></strong>nmouseover="this.alt='';showtip('my tooltip')" o<strong></strong>nmouseout="hidetip()" rel="light" alt="lorem ipsum" />


JS Code
<script class="example" type="text/javascript"> 
// Create the tooltips only when document ready
$(document).ready(function()
{
   // Use the each() method to gain access to each elements attributes
   $('area').each(function()
   {
      $(this).qtip(
      {
         content: $(this).attr('alt'), // Use the ALT attribute of the area map
         style: {
            name: $(this).attr('rel'), // Use the elements defined style
            border: {
               width: 0, 
               radius: 4 
            }, 
            tip: true // Apply a tip at the default tooltip corner
         },
         position: {
            corner: {
               target: 'rightMiddle',
               tooltip: 'leftMiddle'
            }
         }
      });
   });
});
</script>

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
13th August, 21:17
Post: #5
styling tooltips with an image map
This works perfectly. Thank you so much Craig! I really appreciate it, you saved the day! Wink
Find all posts by this user
Quote this message in a reply
26th January, 16:45
Post: #6
styling tooltips with an image map
Is it possible, to use qtip with an image map not only to view "alt" in tooltips, but to buld tooltips like in this demo http://craigsworks.com/projects/qtip/dem...nt/loading ?
Find all posts by this user
Quote this message in a reply
27th January, 01:27
Post: #7
styling tooltips with an image map
MiH, most definitely. You'd just use the content.url option in your configuration and you'd be set.

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
27th January, 05:05 (This post was last modified: 28th January 10:03 by BBonifield.)
Post: #8
styling tooltips with an image map
ok! I won! =)
html
JS Code
<area shape="circle" coords="446,121,23" rel="index.php" href="#" alt='????????????? ??????' />

java
JS Code
<script type="text/javascript">
// Create the tooltips only when document ready
$(document).ready(function()
{
   // Use the each() method to gain access to each elements attributes
   $('area').each(function()
   {
      $(this).qtip(
      {
         content: {
            url: $(this).attr('rel'), method: 'post',
            title: {
               text: $(this).attr('alt'), // Give the tooltip a title using each elements text
               button: '???????' // Show a close link in the title
            }
},
hide: 'click',
// Use the ALT attribute of the area map
         style: {
            name: 'light', // Give it the preset dark style
            border: {
               width: 0, 
 
               radius: 4,
 
            }, 
            tip: true // Apply a tip at the default tooltip corner
         },
        position: {
      corner: {
         target: 'rightMiddle',
         tooltip: 'leftMiddle'
      }
     }
 
      });
   });
});
</script>


but can't see tips in Opera 9.24 and IE6... don't know why..
Find all posts by this user
Quote this message in a reply
28th January, 11:04
Post: #9
styling tooltips with an image map
fixed!!
trailing comma!!
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Qtip on image is not showing in safari naughtylak 1 1,396 23rd November 01:26
Last Post: Craig



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