Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Position of Qtip?
23rd June, 22:33
Post: #1
Dynamic Position of Qtip?
I tried this to change the position of the qtip before showing it, but it doesn't work. Can anyone help?
JS Code
$(elements).each(function () {
    $(this).qtip( {
        content: 'some content'
     });
     var target = $(this);
     var api = $(this).qtip('api');
     api.beforeShow = function () {
         target.qtip( {
             position: {
                 corner: {
                     target: 'leftMiddle',
                     tooltip: 'rightMiddle'
                 }
             }
         });
         //api.updatePosition(); also tried this
    }
});

This is just a test, I want to be able to set different target corners depending on the space available.

Any help very much appreciated.
Find all posts by this user
Quote this message in a reply
25th June, 14:25
Post: #2
RE: Dynamic Position of Qtip?
Try this Squashed:

JS Code
$(elements).each(function () {
	$(this).qtip( {
		content: 'some content',
		api: {
			beforeShow: function () {
				this.options.position.corner = {
					target: 'leftMiddle',
					tooltip: 'rightMiddle'
				}
			}
		}
	});
});

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 June, 00:06
Post: #3
RE: Dynamic Position of Qtip?
(25th June 14:25)Craig Wrote:  Try this Squashed:

JS Code
$(elements).each(function () {
	$(this).qtip( {
		content: 'some content',
		api: {
			beforeShow: function () {
				this.options.position.corner = {
					target: 'leftMiddle',
					tooltip: 'rightMiddle'
				}
			}
		}
	});
});

Thanks for the reply Craig, however the code above appears to position at target: leftTop, tooltip: leftTop.

I have managed to make it work by borrowing an idea from one of the examples and use a mouseenter function to destroy/recreate the tip each time. However this doesn't seem to be a very efficient approach.

I also want to set the tip size depending on the space available in the browser window and the position of the target, so that the tip is always fully visible (I also set overflow: auto). I have worked out how to do that bit, the question is how to best update the tip dimensions and position.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] Dynamic Content From Page Element frogg3862 2 81 3rd May 17:12
Last Post: frogg3862
  can't hide qtip in a “position: absolute;” div shdog 1 267 14th March 17:35
Last Post: Craig
  Position of qTip Modal from call within a tooltip chuuke 1 259 17th January 21:54
Last Post: Craig
  show qtip in a specified div or position myapweb 1 572 27th December 17:53
Last Post: Craig
  Dynamic contenct not working property in sortable cleung 5 725 8th December 18:45
Last Post: Craig
  [Solved] dynamic tipcreation alnikitich 1 443 8th December 18:29
Last Post: Craig
  [Solved] Dynamic content based off map area befeetback 1 1,035 25th August 18:23
Last Post: Craig
  how to get dynamic attri('id') before displaying on content davidkhan 3 612 23rd August 18:04
Last Post: Craig
  [Solved] Dynamic content not showing? dabd 3 800 21st August 18:17
Last Post: Craig
  [Solved] dynamic content based on child eement yisman 8 1,224 27th July 14:29
Last Post: yisman



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