Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem loading html content from hidden div
26th August, 11:26
Post: #1
Problem loading html content from hidden div
First off, I know this is probably a simple one and there are similar threads for which I apologise, but I have tried several options with no success.

I am trying to load my qTip content from a div which contains a call to some server side code (classic ASP). This code goes and gets the file type and file size of a give file name. This works ok, but my qTip only looks at the first div with the given class name on the page.

JS Code
$('a.<%= strHandler %>').each(function() {
   		$(this).qtip({
      		content: {
				text: $(this).attr('title') + $(this).next('.moreInfo').html()
			},
	  		show: { 
				solo: true
			},
			position: {
      			corner: {
					target: 'rightMiddle',
					tooltip: 'leftMiddle'
      			}
	  		},
			style: { 
				maxwidth: 300,
				padding: 5,
				background: '#A2D959',
				color: 'black',
				//textAlign: 'justify',
 
				border: {
					width: 7,
					radius: 5,
					color: '#A2D959'
				},
			  tip: 'leftMiddle',
			  name: 'dark' // Inherit the rest of the attributes from the preset dark style
			},
			// Remove default browser tooltip
			api: {
				onRender: function(){ 
					this.elements.target.removeAttr('title')
				}
			}
	   });
	});


Here is my HTML
JS Code
<p><a class="<%= strHandler %>" title="Some Title Text" href="/folder/subfolder/filename<%= strSampleFileType %>">Sample</a></p>
    	<div class="moreInfo"><%getFileSize("/folder/subfolder/filename"&strSampleFileType)%></div>    
 
<p><a class="<%= strHandler %>" title="Another Title Text" href="/folder/subfolder/filename2<%= strSampleFileType %>">Sample</a></p>
        <div class="moreInfo"><%getFileSize("/folder/subfolder/filename2"&strSampleFileType)%></div>
 
<p><a class="<%= strHandler %>" title="Yet Another Title Text" href="/folder/subfolder/filename3<%= strSampleFileType %>">Sample</a></p>
        <div class="moreInfo"><%getFileSize("/folder/subfolder/filename3"&strSampleFileType)%></div>


Could anyone kindly offer some help? As I say, it's probably a simple fix, but my head is a bit frazzled and I'm struggling to find an appropriate solution.
Find all posts by this user
Quote this message in a reply
26th August, 13:39
Post: #2
RE: Problem loading html content from hidden div
Your moreInfo div is next to your parent p element, not your a element Wink Try this out instead:

JS Code
$('a.<%= strHandler %>').each(function() {
         $(this).qtip({
            content: {
               text: $(this).attr('title') + $(this).parent().next('.moreInfo').html()
           },
           show: { 
            solo: true
         },
         position: {
               corner: {
               target: 'rightMiddle',
               tooltip: 'leftMiddle'
               }
           },
         style: { 
            maxwidth: 300,
            padding: 5,
            background: '#A2D959',
            color: 'black',
            //textAlign: 'justify',
 
            border: {
               width: 7,
               radius: 5,
               color: '#A2D959'
            },
           tip: 'leftMiddle',
           name: 'dark' // Inherit the rest of the attributes from the preset dark style
         },
         // Remove default browser tooltip
         api: {
            onRender: function(){ 
               this.elements.target.removeAttr('title')
            }
         }
      });
   });

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
26th August, 14:09
Post: #3
RE: Problem loading html content from hidden div
(26th August 13:39)Craig Wrote:  Your moreInfo div is next to your parent p element, not your a element Wink Try this out instead:

JS Code
$('a.<%= strHandler %>').each(function() {
         $(this).qtip({
            content: {
               text: $(this).attr('title') + $(this).parent().next('.moreInfo').html()
           },
           show: { 
            solo: true
         },
         position: {
               corner: {
               target: 'rightMiddle',
               tooltip: 'leftMiddle'
               }
           },
         style: { 
            maxwidth: 300,
            padding: 5,
            background: '#A2D959',
            color: 'black',
            //textAlign: 'justify',
 
            border: {
               width: 7,
               radius: 5,
               color: '#A2D959'
            },
           tip: 'leftMiddle',
           name: 'dark' // Inherit the rest of the attributes from the preset dark style
         },
         // Remove default browser tooltip
         api: {
            onRender: function(){ 
               this.elements.target.removeAttr('title')
            }
         }
      });
   });

Craig, you're an absolute gent! Thank you. Big Grin
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] qtip showing content from db doesn't change when content in db changes. vtoepel 2 146 23rd April 16:02
Last Post: vtoepel
  [Solved] qTip Ajax data for text in a div akhil_csit 1 325 14th March 19:27
Last Post: Craig
  can't hide qtip in a “position: absolute;” div shdog 1 283 14th March 17:35
Last Post: Craig
  calling .html using the element id matthearn 0 311 24th February 15:08
Last Post: matthearn
  [Solved] Putting a bunch of html in the mouse over rd42 2 364 21st February 18:49
Last Post: rd42
  Hiding tooltip problem sohailanwarpk 2 408 31st January 12:13
Last Post: sohailanwarpk
  Tooltips not loading jQuery or other js files from parent document crodesign 2 484 13th January 22:19
Last Post: crodesign
  show qtip in a specified div or position myapweb 1 593 27th December 17:53
Last Post: Craig
  [Solved] QTip content from existing div element on page? dcash 4 2,530 8th December 18:29
Last Post: Craig
  Changing HTML Content on Click & Remove/Reinit qTips ifthatdoesntdoit 5 1,237 17th November 09:46
Last Post: ifthatdoesntdoit



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