aboutsummaryrefslogtreecommitdiff
path: root/mod/profile/profile.js
blob: 278793c277020416bb693591442d7916c70ce25a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	/**
	 * Elgg profile javascript library
	 * 
	 * @package ElggProfile
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Ben Werdmuller <ben@curverider.co.uk>
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.com/
	 * 
	 */
	 
function remove_user_menu() {

	$("#user_menu").hover(function() {}, function () {
		$("#user_menu").remove();
	});
		
};

$(document).ready(function () {
	
	$("a.icon").hover(function(e) {										  
		
		var userdescription = this.rel;

		var dwidth = $(document).width();

		$("body").append("<div id='user_menu'>"+ userdescription + "</div>");

		var top = e.pageY - 10;
		var left = e.pageX - 10;
		
		if ((left + 10 + $("#user_menu").width()) > (dwidth - 10)) {
			left = dwidth - $("#user_menu").width() - 50;
		}

		$("#user_menu")
			.css("top",(top) + "px")
			.css("left",(left) + "px")
			.fadeIn("medium");
			
		
		remove_user_menu();
			
    });

});