Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using the API's updatePosition
27th July, 22:44
Post: #1
Using the API's updatePosition
Hello everybody,

I'm using qtips on a page that changes elements based on user input to a field. I'm having problems making the qtips change where they're targeted. I'm trying to call the updatePosition method from within the function that handles changes for the input box so that the qtips target the proper side of the elements.

Here's the call I make in the function
JS Code
$('.qtip').qtip('api').updatePosition();


And here's the js for qtip: (Please excuse the commented out stuff everywhere)
JS Code
$('input.field, td.field>*').each(function(){      
         $parent = $(this.parentNode)
         parentClass = $parent.attr('class')
         $child = $(this.childNode)
         childClass = $child.attr('class')
         childID = $child.attr('id')
         currentID = $(this).attr('id')
         currentID = currentID.substring(0, currentID.length - 1 )
         target = currentID.replace('-','')
         target = '#' + target + '2'
 
         $(this).qtip({
            position:{
               adjust: { //Make the tooltip avoid going outside the window due to browser resizing
                     resize: true, 
                  //   screen: true, //Makes the qtips act strangely when they are fairly large
                     },
               corner: {
                     target: 'rightMiddle',
                     tooltip: 'leftMiddle',
                     },
               target: $(target),
            //   target: $(this),
                   },
            style:{ //Style the qtip to look like the page
                 color: 'black',
                 textAlign: 'center',
                  title: { color: 'white', background: '#707070'},
                 width: { max: 340 },
                 //This is a good width because it makes the far edge of the tooltip about 1024 pixels from the left side of the screen, making it 1024x768 friendly
                 border:{ 
                      width: 6, 
                      color: '#a2ddff'
                      },
                 tip: { //Options for the tail
                     corner: 'leftMiddle', 
                     color: '#a2ddff',
                     size: { x: 20, y : 15 }
                     },
                  },
            show:{ //Show only one qtip, and show it when somebody clicks 
                 when: { event: 'click' }, 
                 solo: true ,
                 effect:{ 
                      length: 25, 
                      type:'grow' 
                      },
                },
            hide: 'false', //This makes the qtips stick around a bit more, and makes them less annoying
 
            /*    { //Hide when a click is made outside the qtip
                 when: { event: 'unfocus'} ,
                 effect:{ 
                      length: 150, 
                      },
                },  */
            content:{
                  prerender: false,//This kills pageload times if enabled
                  text: 'Parent Class: ' + parentClass + ' This Class: ' + $(this).attr('class') + ' This ID: ' + $(this).attr('id') + ' Child Class: ' + childClass + ' ChildID ' + childID + ' Target: '+ target + ' Number!: ' + n + ' Other Number, should be the same ' + parseInt($('#id_residues').val()),
               //   url: '{{SITE_ROOT}}search/qtiphelp/',
               //   method: 'get',
               //   data: { id: parentClass + '_help' },
                  title:  {
                        text: '<a href="{{SITE_ROOT}}search/help/#sea">Need Some More Help?</a> ',
                        button: 'Close' //Enables a button that closes the qtip
                        }
                  },
            });
         });


Thanks for any help in advance. Also, awesome work Craig, qtip is sweet.
Find all posts by this user
Quote this message in a reply
28th July, 09:07
Post: #2
Using the API's updatePosition
SojournerWest, could you give a bit more detail on what your trying to accomplish? I'm not quite sure I understand what your trying to do. Are you wanting to simply update the position of the tooltips when a specific function is called?

Oh and thank you Smile I can live for two months on a good compliment. ~Mark Twain Wink

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
28th July, 15:17
Post: #3
Using the API's updatePosition
Yeah, that's essentially what I'm trying to do. Right now though, I'm getting an error:
JS Code
f(this).data("qtip") is undefined

Which seems to be caused by calling the api ".qtip('api')"

Thanks,

SW
Find all posts by this user
Quote this message in a reply
29th July, 11:06
Post: #4
Using the API's updatePosition
SojournerWest Wrote:I'm getting an error:
JS Code
f(this).data("qtip") is undefined

It could mean you are trying to get "api"-object from an element that actually doesn't have a qtip. Also it could signify scope problem.

service.makariv.net
maximuse.net
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
  Show api function not working occulens 1 692 27th May 17:10
Last Post: Craig
  updatePosition() works only once alexp 0 658 10th May 19:30
Last Post: alexp
  [Solved] Cannot access api Chris_Bones 2 563 26th January 15:52
Last Post: Chris_Bones
  [Solved] API: this.elements is undefined SePP 4 1,536 9th December 09:27
Last Post: Yann39
  Hide (api) doesn't work with Tip (triangle) only cheetos 1 866 23rd November 23:33
Last Post: Craig
  cant load spark lines (API issue) Alain 2 1,335 27th August 13:30
Last Post: Alain
  [Solved] Error : "$(this).qtip("api").status is undefined" rohan 2 1,977 2nd July 17:18
Last Post: rohan
  IE8 api.options null or not an object error pmetha 1 2,017 21st June 17:23
Last Post: Craig
  qTip is a great API lastnico 2 612 27th April 14:27
Last Post: lastnico
  [Solved] using the updateStyle API call rmckillen 2 899 5th April 17:14
Last Post: rmckillen



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