Activity Stream
48,167 MEMBERS
6700 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 6 of 6
  1.     
    #1
    Member
    Website's:
    maxneeds.info

    Red face jQuery tooltip help :S

    Hi !
    I am currently using jquery tooltip to replace the ordinary title attributes and it is quite well,but there is only one problem : tooltips do not update in time..

    Lets say i have : <img src=balba.jpg title='not clicked' onclick=this.title='clicked'> ..

    Simply when user clicks the image the tooltip does not change to 'clicked' and stays 'not clicked'

    Anyone can give me a script ?


    Here's my current one :
    Code: 
    /**
    *
    *	simpleTooltip jQuery plugin, by Marius ILIE
    *	visit http://dev.mariusilie.net for details
    *
    **/
    (function($){ $.fn.simpletooltip = function(){
    	return this.each(function() {
    		var text = $(this).attr("title");
    		$(this).attr("title", "");
    		if(text != undefined) {
    			$(this).hover(function(e){
    				var tipX = e.pageX + 12;
    				var tipY = e.pageY + 12;
    				$(this).attr("title", ""); 
    				$("body").append("<div id='simpleTooltip' style='position: absolute; z-index: 100; display: block;'>" + text + "</div>");
    				if($.browser.msie) var tipWidth = $("#simpleTooltip").outerWidth(true)
    				else var tipWidth = $("#simpleTooltip").width()
    				$("#simpleTooltip").width(tipWidth);
    				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeTo("fast", 0.80);
    			}, function(){
    				$("#simpleTooltip").remove();
    				$(this).attr("title", text);
    			});
    			$(this).mousemove(function(e){
    				var tipX = e.pageX + 12;
    				var tipY = e.pageY + 12;
    				var tipWidth = $("#simpleTooltip").outerWidth(true);
    				var tipHeight = $("#simpleTooltip").outerHeight(true);
    				if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth;
    				if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
    				$("#simpleTooltip").css("left", tipX).css("top", tipY).fadeTo("fast", 0.80);
    			});
    		}
    	});
    }})(jQuery);
    Porsche_maniak Reviewed by Porsche_maniak on . jQuery tooltip help :S Hi ! I am currently using jquery tooltip to replace the ordinary title attributes and it is quite well,but there is only one problem : tooltips do not update in time.. Lets say i have : <img src=balba.jpg title='not clicked' onclick=this.title='clicked'> .. Simply when user clicks the image the tooltip does not change to 'clicked' and stays 'not clicked' :S Anyone can give me a script ? Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    try onclick="this.title='clicked'"

  4.     
    #3
    Member
    Website's:
    maxneeds.info
    tnx Jueki but it is not about that..

  5.     
    #4
    Member
    I don't understand what exactly you mean then :/ sorry.

  6.     
    #5
    Member
    Website's:
    maxneeds.info
    anyone can help ?

  7.     
    #6
    Member
    Website's:
    th3fallen.com
    i notice that your jquery doesnt load from document ready, that could the problem but i usually try to stay away from onclick actions for tool tips

    what i would do is something like this...
    Code: 
    $(document).ready(function() {     //Tooltips     $(".tip_trigger").hover(function(){         tip = $(this).find('.tip');         tip.show(); //Show tooltip     }, function() {         tip.hide(); //Hide tooltip     }).mousemove(function(e) {         var mousex = e.pageX   20; //Get X coodrinates         var mousey = e.pageY   20; //Get Y coordinates         var tipWidth = tip.width(); //Find width of tooltip         var tipHeight = tip.height(); //Find height of tooltip          //Distance of element from the right edge of viewport         var tipVisX = $(window).width() - (mousex   tipWidth);         //Distance of element from the bottom of viewport         var tipVisY = $(window).height() - (mousey   tipHeight);          if ( tipVisX < 20 ) { //If tooltip exceeds the X coordinate of viewport             mousex = e.pageX - tipWidth - 20;         } if ( tipVisY < 20 ) { //If tooltip exceeds the Y coordinate of viewport             mousey = e.pageY - tipHeight - 20;         }         //Absolute position the tooltip according to mouse position         tip.css({  top: mousey, left: mousex });     }); });
    Make sure your calling the jquery library from an external source as well that helps alot with your bandwith i usually use this

    Code: 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
    then you need to style them i just threw an easy black example css for the box

    Code: 
    .tip {     color: #fff;     background:#1d1d1d;     display:none; /*--Hides by default--*/     padding:10px;     position:absolute;    z-index:1000;     -webkit-border-radius: 3px;     -moz-border-radius: 3px;     border-radius: 3px; }
    Then for your link you would want to do this

    Code: 
    <a href="#" class="tip_trigger">Your Link Key Word <span class="tip">This will show up in the tooltip</span></a>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JQuery and RegExr Help :|
    By Porsche_maniak in forum Web Development Area
    Replies: 4
    Last Post: 1st Jun 2012, 12:26 AM
  2. [Hiring] Coder with exp in DLE, jquery
    By newshit in forum Completed Transactions
    Replies: 0
    Last Post: 11th Jan 2012, 09:42 PM
  3. JQuery help
    By xElliex in forum Web Development Area
    Replies: 5
    Last Post: 25th Aug 2011, 10:38 PM
  4. jQuery tooltip help
    By devilzkrazy in forum Technical Help Desk Support
    Replies: 0
    Last Post: 22nd May 2010, 04:24 PM
  5. Introduction to jQuery
    By litewarez in forum Tutorials and Guides
    Replies: 4
    Last Post: 14th Jan 2010, 02:51 AM

Tags for this Thread

BE SOCIAL