Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Load div in qtip
23rd March, 05:07 (This post was last modified: 23rd March 05:11 by nharry.)
Post: #1
Wink [Solved] Load div in qtip
Firstly I would like to say what an excellent plugin this is (so many options Smile)

I have a question, I would like to load a div using qtip and am unsure how to go about it.

This is the JS i have:

$('.moviebox').qtip({
content: [load div class info here],
show: 'mouseover',
hide: 'mouseout',
style: { name: 'dark' },
position: {
corner: {
target: 'bottommiddle',
tooltip: 'bottomleft'
}
}
})

And this is the html:


<div class="movieboxwrapper">
<div class="moviebox"><a href="#"><img src="/moviesite/images/covers/beethovens_second.jpg" /></a>
<div class="info">film about a dog</div>
</div>
</div>

<div class="movieboxwrapper">
<div class="moviebox"><a href="#"><img src="/moviesite/images/covers/matrix.jpg" /></a>
<div class="info">This movie is about a guy who thinks hes cool because his world is green writing</div>
</div>
</div>



I want the div with the class info to be shown when a user hovers the moviebox. If i have made no sense let me know.



Help please
Find all posts by this user
Quote this message in a reply
23rd March, 06:30
Post: #2
RE: Load div in qtip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$('.moviebox').qtip({
  content: $(this).children('.info'),
   show: 'mouseover',
   hide: 'mouseout',
   style: { name: 'dark' },
   position: {
      corner: {
         target: 'bottommiddle',
         tooltip: 'bottomleft'
      }
   }
});
 
// since the qTip copies the content of the info div, you can remove it now
$('.moviebox').remove('.info');
Find all posts by this user
Quote this message in a reply
23rd March, 07:24
Post: #3
RE: Load div in qtip
(23rd March 06:30)sveiki Wrote:  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$('.moviebox').qtip({
  content: $(this).children('.info'),
   show: 'mouseover',
   hide: 'mouseout',
   style: { name: 'dark' },
   position: {
      corner: {
         target: 'bottommiddle',
         tooltip: 'bottomleft'
      }
   }
});
 
// since the qTip copies the content of the info div, you can remove it now
$('.moviebox').remove('.info');

Thanks for the help. Still have a problem. It seems that $(this) doesn't work. The qtip appears but box is blank.

When I change the code to:

$('.moviebox').qtip({
content: $('.moviebox').children('.info'),
show: 'mouseover',
hide: 'mouseout',
style: { name: 'dark' },
position: {
corner: {
target: 'bottommiddle',
tooltip: 'bottomleft'
}
}
});

The text appears in the box but that is incorrect because it shows the same text on all images.

Any ideas ???
Find all posts by this user
Quote this message in a reply
23rd March, 07:45
Post: #4
RE: Load div in qtip
Try this instead:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$('.moviebox').each(function() {
   $(this).qtip({
      content: $(this).children('.info'),
      show: 'mouseover',
      hide: 'mouseout',
      style: { name: 'dark' },
      position: {
         corner: {
            target: 'bottommiddle',
            tooltip: 'bottomleft'
         }
      }
   });
});
 
// since the qTip copies the content of the info div, you can remove it now
$('.moviebox').remove('.info');
Find all posts by this user
Quote this message in a reply
23rd March, 07:50
Post: #5
RE: Load div in qtip
(23rd March 07:45)sveiki Wrote:  Try this instead:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$('.moviebox').each(function() {
   $(this).qtip({
      content: $(this).children('.info'),
      show: 'mouseover',
      hide: 'mouseout',
      style: { name: 'dark' },
      position: {
         corner: {
            target: 'bottommiddle',
            tooltip: 'bottomleft'
         }
      }
   });
});
 
// since the qTip copies the content of the info div, you can remove it now
$('.moviebox').remove('.info');

Working like a dream. Many Many Many thanks. YOU THE MAN!!
Find all posts by this user
Quote this message in a reply
31st May, 23:09
Post: #6
RE: Load div in qtip
I can't for the life of me get this tooltip to work?!

I think I want to do something similar to this..
I want to have images on page whihc when hovered over popup a tooltip which has content taken from a hidden div on the page.

This content will have some text and an image and I want it to fade into view and fade out on mouseout.

I tried copying and pasting the below code and using the Jquery script (packaged one as well as the latest 1.4.2min) and I cannot get any tooltip to appear?!

I inserted the above code into my head like so:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script type="text/javascript">
$(document).ready(function() {
$('.moviebox').each(function() {
   $(this).qtip({
      content: $(this).children('.info'),
      show: 'mouseover',
      hide: 'mouseout',
      style: { name: 'dark' },
      position: {
         corner: {
            target: 'bottommiddle',
            tooltip: 'bottomleft'
         }
      }
   });
});
 
// since the qTip copies the content of the info div, you can remove it now
$('.moviebox').remove('.info');
});
</script>


used the same HTML:
1
2
3
4
5
6
7
8
9
10
11
<div class="movieboxwrapper">
<div class="moviebox"><a href="#"><img src="images/logo_smallwhite.png" /></a>
<div class="info">film about a dog</div>
</div>
</div>
 
<div class="movieboxwrapper">
<div class="moviebox"><a href="#"><img src="images/logo_smallwhite.png" /></a>
<div class="info">This movie is about a guy who thinks hes cool because his world is green writing</div>
</div>
</div>


and placed the scripts just before the </body> tag like so:
1
2
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.qtip-1.0.0-rc3.min.js"></script>


And I get nothing??
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  cant load spark lines (API issue) Alain 2 54 27th August 23:30
Last Post: Alain
  Problem loading html content from hidden div SpinDrift 2 71 27th August 00:09
Last Post: SpinDrift
  [Solved] Problem with creating qtips on div tag kolkar 5 156 24th August 16:15
Last Post: kolkar
  [Solved] Attach qtip to a div with display none oliveqtip 0 135 27th June 04:13
Last Post: oliveqtip
  [Solved] Add qTip to div before it's available.. chiggz 1 200 25th June 03:26
Last Post: chiggz
  How can i display qtip in place of standard div? garpinc 2 244 15th May 23:17
Last Post: Craig
  Delay content load thrue ajax R1_Bzh 1 383 9th May 22:35
Last Post: Craig
  [Solved] Loading Dynamic Images will only load the first one Hexer 9 755 30th April 19:00
Last Post: Hexer
  disabling defualt style with content div tag kh_amit2003 0 274 8th April 06:24
Last Post: kh_amit2003
  [Solved] QTip with DIV tag kyoung91 2 301 3rd April 06:35
Last Post: kyoung91