Solved

JS plugin Qtip2 popup customisation

Posted on 2014-12-12
2
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

749 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