Notice: Undefined index: order_next_posts in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 194

Notice: Undefined index: post_link_target in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 195

Notice: Undefined index: posts_featured_size in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 196

Add hotspot tooltips with jQuery

Here we show you how to add click or hover hotspots to your web images with the iPicture2 jQuery plugin

Add hotspot tooltips with jQuery


Pick up iPicture2

For this example we’re going to use the iPicture2 plugin by Sara D’Alia. What this plugin does is allow you to very quickly overlay hotspot ‘dot’ buttons on an image, offering tooltip text for annotation purposes. These can easily be toggled between hover or click modes, requiring no code whatsoever. To start, head over to and click the download link to save the zip.

Essential plugin files

Unpack the zip archive and we’ll start by isolating the basic files we’ll need. From the ‘css’ folder we need ‘iPicture.css’, along with ‘jquery.picture.js’ from the ‘js’ folder. Copy them into the root of a new HTML document. We also need the ‘images’ folder, so copy that too. However, if you wish, you can dispense of the contents apart from the ‘moreblack’ and ‘morewatergreen’ folders inside.

Attach the plugin

In the head of the page we need to link iPicture2’s stylesheet, then the latest jQuery CDN. After that we can attach the ‘jquery.ipicture.js’ file as follows:

001    <link rel=”stylesheet” type=”text/
css” media=”screen” href=”css/
002    <script src=”
003    <script type=”text/javascript” src=

The wizard’s way

Referring back to the original plugin files, among the demos you’ll find ‘wizard.html’, so open this page in your browser. iPicture2 neatly provides this ‘wizard’ tool for dragging and dropping the dot icons onto a selected image. So, browse for your chosen graphic and position as many as you require before clicking the ‘Get code’ button below. This will generate the code you need to copy and paste into your page body:

001    <div id=”iPicture” data-interaction
002    <div class=”ip_slide”>
003            <img class=”ip_tooltipImg” 
004            <div class=”ip_tooltip ip_img32”
style=”top: 348px; left: 153px;
” data-button=”moreblack” data-
tooltipbg=”bgblack” data-round=
”roundBgW” data-animationtype=
005                <p>
006                </p>
007            </div>
<!--Extra dots appear here-->
008        </div>
009    </div>
010    <script>
011        $(“#iPicture”).iPicture();
012    </script>

Add your text

The previous code will add the default black dots with blank black bubbles to your image. As long as you have the corresponding folder in your images folder you can change this as we have to ‘morewatergreen’ or any of the other supplied colours. You then add your bubble text by just adding a string between the <p> tags of each hotspot <div> element, like so:

001    <div id=”iPicture” data-
002    <div class=”ip_slide”>
003        <img class=”ip_tooltipImg” src=
004        <div class=”ip_tooltip ip_img32
” style=”top: 348px; left: 153px;
” data-button=”morewatergreen” 
data-tooltipbg=”bgblack” data-
round=”roundBgW” data-
005    <p>Silver Sands hotel and casino</p>
006    </div>

From hover to click

To switch iPicture2 between hover or click interactions, you only have to change a single line. Simply amend the data-interaction field of the main ‘iPicture’ container <div> to ‘hover’ or ‘click’ as desired. Like our example, you might also like to change the default cursor to the pointer by extending the’ .ip_tooltip’ CSS class. Add the lines, save the page and preview!

001    CSS:
002    <style>
003    .ip_tooltip {
004         cursor: pointer;
005    }
006    </style>
001    <div id=”iPicture” data-

Improve your web design skills with Web Designer. Download issues direct from or buy print issues from ImagineShop