Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Why is this not working - Link nested in tooltip
11th September, 19:45
Post: #1
[Solved] Why is this not working - Link nested in tooltip
I am a beginner in JS and I don't know why this is not working. Huh
I wanna put some links within the tooltip. The links will be provided dynamically via PHP.
Plz help.

JS Code
...
<a href="#">Microsoft</a>
<span class="text">sample text with links 1</span>
<a href="#">jQuery</a>
<span class="text">sample text with links 2</span>
</div>
</div>
</div>
<!--Footer JavaScript-->
<script type="text/javascript" src="../js/jquery_qtip.js"></script>
<script type="text/javascript">
 
$(document).ready(function() {
 
	if( $(this).next('.text').length < 1 ) { return true; }
 
	    $(this).qtip({
        	content: $(this).next('.text'), // Use the tooltip attribute of the element for the content
 
			show: { solo: true, when: { event: 'click' } },
		 	hide: { fixed: true, delay: 1000 },
		  	position: {
      		corner: {
        	target: 'topRight',
         	tooltip: 'bottomLeft' }
  			},
 
			style: { 
     		width: 100,
     		padding: 5,
      		//background: '#A2D959',
     		color: 'black',
      		textAlign: 'center',
      		border: {
         	width: 2,
         	radius: 2,
        	color: '#273183'
     		},
     		tip: 'bottomLeft',
     		name: 'blue'
   			}
     });
});
</script>
</body>
</html>
Find all posts by this user
Quote this message in a reply
12th September, 17:10
Post: #2
RE: Why is this not working - Link nested in tooltip
Erm, well you're not actually selecting the links at all in your code... and you're using "this" which in the context of the document.ready refers to the document... try this:

JS Code
$(document).ready(function() {
   $('a[href]').each(function() {
       if( $(this).next('.text').length < 1 ) { return true; }
       $(this).qtip({
           content: $(this).next('.text'), // Use the tooltip attribute of the element for the content
 
         show: { solo: true, when: { event: 'click' } },
          hide: { fixed: true, delay: 1000 },
           position: {
            corner: {
           target: 'topRight',
            tooltip: 'bottomLeft' }
           },
 
         style: { 
           width: 100,
           padding: 5,
            //background: '#A2D959',
           color: 'black',
            textAlign: 'center',
            border: {
            width: 2,
            radius: 2,
           color: '#273183'
           },
           tip: 'bottomLeft',
           name: 'blue'
            }
     });
   });
});

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  qtip only working the first time harjits 2 24 Yesterday 23:31
Last Post: Craig
  Link needs to be clicked twice sunwise 1 85 17th April 18:26
Last Post: Craig
  Link Tooltip is not opened toplisek 2 547 5th January 09:53
Last Post: toplisek
  [Solved] Qtip getting ID of link naupadnara 2 408 4th January 16:19
Last Post: naupadnara
  Dynamic contenct not working property in sortable cleung 5 737 8th December 18:45
Last Post: Craig
  Nested 'spans' ttomor 1 592 24th October 22:08
Last Post: ttomor
  Youtube demo not working on ffox 6 & 7 ivanmayes 2 696 11th October 17:14
Last Post: ivanmayes
  nested lists and qtip for the last mouseenter element ??? thbenda 0 340 4th October 09:24
Last Post: thbenda
  [Solved] Blanket Destroy not working migdalskiy 2 512 22nd August 22:44
Last Post: migdalskiy
  Unfocus Not Working biglesliep 1 760 13th August 12:50
Last Post: Craig



User(s) browsing this thread: 1 Guest(s)