SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2008
    Location
    Plymouth, United Kingdon
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery: $("...").something.function(e){...});

    hi,
    this is a jquery tooltip i got it from somewhere, and i am trying to understand this code, it seems quite straight forward, but i dont understand what does that 'e' stand for? i come across this often in other kind of jquey plugins/ functions written by other people...

    Code:
    this.tooltip = function(){	
    	/* CONFIG */		
    		xOffset = 10;
    		yOffset = 20;		
    		// these 2 variable determine popup's distance from the cursor
    		// you might want to adjust to get the right result		
    	/* END CONFIG */		
    	$("#logo img").hover(function(e){											  
    		this.t = this.title;
    		this.title = "";									  
    		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
    		$("#tooltip")
    			.css("top",(e.pageY - xOffset) + "px")
    			.css("left",(e.pageX + yOffset) + "px")
    			.fadeIn("fast");		
        },
    	function(){
    		this.title = this.t;		
    		$("#tooltip").remove();
        });	
    	$("#logo img").mousemove(function(e){
    		$("#tooltip")
    			.css("top",(e.pageY - xOffset) + "px")
    			.css("left",(e.pageX + yOffset) + "px");
    	});			
    };
    it will be great to know what it means and how to use it.
    many thanks,
    Lau

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cross browser css bugs

    Dan Schulz you will be missed

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    The e is short for event, often identified as e or evt

    It's not actually used in the code sample in the OP, but it's a common feature of any event-driven code to help remind you that's it's available to you should you want to add additional behaviour to the code.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Evangelist
    Join Date
    Dec 2008
    Location
    Plymouth, United Kingdon
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SoulScratch View Post
    thanks for the link. its very helpful.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •