Solved

JS plugin Qtip2 popup customisation

Posted on 2014-12-12
2
239 Views
Last Modified: 2014-12-15
on my page i have an image, with an image map e.g.
<map id="points" name="points">   
        <area shape="circle" alt="point 1" coords="79,165,5" href="chapt1.pdf">
        <area shape="circle" alt="point 2" coords="60,165,5" href="#chapt2">
        ...

Open in new window

using the qtip2 plugin, i can make the points hotspots, however, i would like to customize the popup's title and content area as below:

title text: area alt text e.g. point 1
content: clickable link to href value of area -  (<a href="chapt1.pdf">Point 1</a>) or at least, just clickable link to href value



full qtip config:
$(document).ready(function()
{
	

$('area[alt]').qtip({
   /* content: {
         attr: 'alt'
    },*/
	content: {
		attr: "href",// should be clickable link and display alt text (attr: 'alt')
		title: {text:"Download", //should be area alt text
      button: 'Close'}
         },
  position: {
             target: 'mouse', 
             adjust: {
                 mouse: false
             } 
         },
	 style: {
            classes: 'qtip-light'
        },show: { solo: true }
});

}); 

Open in new window

0
Comment
Question by:weaverk
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
weaverk earned 0 total points
ID: 40500545
$(document).ready(function () {
    $('area').each(function () { //loop through each hotspot, get the necessary values, and set them into required spots in that qtip
        urlLink = $(this).attr('href'); 
        urlName = $(this).attr('alt'); 
        $(this).qtip({

            content: {
                text: '<a href="' + urlLink + '">sometext</a>', //sometext could equally be the urlName
                title: {
                    text: urlName,
                    button: 'Close'
                }
            },
            position: {
                target: 'mouse',
                adjust: {
                    mouse: false
                }
            },
            style: {
                classes: 'qtip-light'
            },
            show: {solo: true}
        });
    });
});

Open in new window

0
 
LVL 1

Author Closing Comment

by:weaverk
ID: 40500547
this is my solution, comments in the code in case somebody else can benefit from this too...
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question