Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Setting default positions?
20th March, 02:02
Post: #1
[Solved] Setting default positions?
No doubt this has been answered before but I can't find it.

I have multiple tips on a page. They all have the same position info, only the content changes.

Currently I have
JS Code
$("#tip1").qtip({
	  		 content: 'Tip 1',
	   			style:{
				tip:"topLeft"
			},
	   		position: {
		  		corner: {
			 		target: 'bottomRight',
			 		tooltip: 'topLeft'
		 		 }
	  		}
		});
		$("#tip2").qtip({
	  		 content: 'Tip 2',
	   			style:{
				tip:"topLeft"
			},
	   		position: {
		  		corner: {
			 		target: 'bottomRight',
			 		tooltip: 'topLeft'
		 		 }
	  		}
		});


I have tried
JS Code
$().qtip({   ***(and $qtip({)***
	   		position: {
		  		corner: {
			 		target: 'bottomRight',
			 		tooltip: 'topLeft'
		 		 }
	  		}
		});
	$("#tip1").qtip({
	  		 content: 'Tip 1',
	   			style:{
				tip:"topLeft"
			}
	   	});
		$("#tip2").qtip({
	  		 content: 'Tip 2',
	   		style:{
				tip:"topLeft"
			     }
	  		}
		});

I am sure there is a way to do it, but I am too thick to work it out.

Thanks in advance.
Find all posts by this user
Quote this message in a reply
20th March, 07:35
Post: #2
RE: Setting default positions?
You can setup a default configuration object and then use the jQuery extend method to combine it with your other configuration option. Like so:
JS Code
tipOptions = 
	{
		style: {
			tip:"topLeft"
		},
		position: {
			corner: {
				target: 'bottomRight',
				tooltip: 'topLeft'
			}
		}
	}
 
$("#tip1").qtip($.extend(tipOptions, 
	{
		content: 'Tip 1'
	})
);
 
$("#tip2").qtip($.extend(tipOptions, 
	{
		content: 'Tip 2'
	})
);

Working jsFiddle example:

http://jsfiddle.net/kiddailey/RMmhY/
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How set width that's greater than default max on for exactly one tip? AlKoch 5 119 7th May 21:33
Last Post: Craig
  specify different positions for separate tool tips c_martini 2 1,010 6th July 19:58
Last Post: Craig
  [Noobie Alert] Why 13 corner positions? PJonDevelopment 1 403 6th April 05:53
Last Post: kiddailey
  [Solved] How to set a default setting wizbay 1 560 29th January 13:24
Last Post: Craig
  [Solved] Internet Explorer still shows default tooltip butch 15 3,454 25th January 14:23
Last Post: aibreanstudio
  Multiple positions bensonmi 6 879 24th January 19:18
Last Post: Craig
  [Solved] Default Effects / Position Osirion 4 884 9th December 13:03
Last Post: Osirion
  [Solved] How to show tip in other positions? majinfaisal 2 757 25th June 17:04
Last Post: majinfaisal
  [Solved] click event - default not prevented franko75 2 1,520 29th April 13:38
Last Post: franko75
  [Solved] Setting a default value for qTip parameters SeanBannister 13 2,830 22nd April 16:53
Last Post: avpman



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