tags:

views:

35

answers:

3

Hello,

I have one link. I want that when user hovers over the link, one page should get rendered which contains all <img> tag and should show it in one box (tooltip type). How can i do this?

Thanks in advance:)

A: 

Have a look at jquery tooltip. Very easy and powerfull way of doing what you want.

Iznogood
@lznogood :- I read and it says `Manual tooltips :Manual tooltips are HTML elements (typically DIVs) that are placed next to the trigger element and they can contain any HTML such as images, links and tables. ` What should i write in this div to make another page render in it?
Ankit Rathod
@Nitsh just use jquery.load() to load the page inside your tooltip. But Ill check the documentation I was sure you could pass it an url. Maybe I am thinking of fancybox(light box on steroids)
Iznogood
A: 

Can you show us what you tried? Or, can you paint some more details as to what your imagination captured? Basically, you are looking to perform an ajax call on mouseover, for example:

$(document).ready(function() {

    // when I mouseover an element with class="foo"
    $(".foo").mouseover(function() {

        // get me a reference to the next (hidden) div relative (or more precisely, sibling) to this element
        var $theDiv = $(this).next("div"); // or wherever it's at

        // using jQuery's $.data utility, I have stored the 'href' of the
        // page/view or whatever this mouseovered element points to.
        // the url parameter to load can optionally have a valid selector attached to it
        // to filter matching elements from the response
        $theDiv.load('linkToLoad.html' + '?dynamicImagePageThingieLink=' + $(this).data('link') + ' img', function() {

            // this will execute once the loading has finished
            alert('The next div has been filled up with image tags from linkToLoad.html');
            $theDiv.slideDown();
        });
    });
});
karim79
@karim79 :- I am trying to perform ajax call and show the response in tooltip. But the plugin that `Iznogood ` suggested doesn't support that. It requires tooltip to be embedded in hidden div.
Ankit Rathod
A: 

Qtip will do what you want very easily, something like this;

<div id="content">
    <a href="javascript:void(0);" rel="/images/image_one.jpg" class="">Image One</a>
    <a href="javascript:void(0);" rel="/images/image_two.jpg" class="">Image Two</a>
    <a href="javascript:void(0);" rel="/images/image_three.jpg" class="">Image Three</a>
</div>

<script type="text/javascript">

$(document).ready(function() 
{
    $('#content a[rel]').each(function()
    {
        $(this).qtip(
        {
            content: {  
                text: '<img class="throbber" src="/images/throbber.gif" alt="Loading..." />',
                url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
                title: {
                    button: 'Close' // Show a close link in the title
                }
             }
         })
     });
 });

 </script>

There are tons of options; check out the example and view the code.

CmdrTallen