Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7272 amit.gupta 1
/** 
2
  * Author 			: Raj Kumar Bharti
3
  * Creation Date 	: 06 Dec 2010
4
  * Project 		: Shop2020
5
  * Copyright 2010 Evon Technologies
6
*/
7
 
8
 
9
$(document).ready(function(){
10
	notificationLen	= 0;
11
	screenCount 	= 0;
12
	closeClickCount = 0;
13
 
14
	// Count Notification length
15
	notificationLen = $("#notification .notificationContent").length;
16
 
17
	// Count notification screens
18
	for(var i=1; i<=notificationLen; i += 3){
19
		screenCount++;
20
	}
21
 
22
	if(notificationLen > 0){
23
 
24
		// Show notification
25
		showNotification();
26
 
27
		// Event for notification close
28
		$('#notificationClose').click(function(){
29
 
30
			closeClickCount++;
31
 
32
			if(notificationLen <= 3){
33
				$('#notification').fadeOut("fast");
34
				closeClickCount = 0;
35
 
36
			}else if(closeClickCount < screenCount){
37
 
38
				// Reset all notification visible state to hidden
39
				$("#notification .notificationContent:eq(0)").hide();
40
				$("#notification .notificationContent:gt(0)").hide();				
41
				$("#notification .notificationContent:eq(0) .borderBottom").hide();
42
				$("#notification .notificationContent:gt(0) .borderBottom").hide();
43
 
44
				// Visible current screen notification
45
				$("#notification .notificationContent:gt(" + (closeClickCount*3 - 1) + ")").fadeIn("fast");
46
				$("#notification .notificationContent:gt(" + (closeClickCount*3 - 1) + ") .borderBottom").fadeIn("fast");
47
				$("#notification .notificationContent:eq(" + ((closeClickCount + 1)*3 - 1) + ") .borderBottom").hide();
48
 
49
				// Hide next screen notification
50
				$("#notification .notificationContent:gt(" + ((closeClickCount + 1)*3 - 1) + ")").hide();
51
				$("#notification .notificationContent:last .borderBottom").hide();	
52
			}else{
53
 
54
				$('#notification').fadeOut("fast");
55
				closeClickCount = 0;
56
			}
57
		});	
58
	}
59
 
60
});
61
 
62
/*
63
 * Show Notification
64
*/
65
function showNotification(){
66
	if(notificationLen > 0){
67
		resetNotification();
68
 
69
		$("#notification .notificationContent:gt(2)").hide();	// Hide notifications greater than 3
70
 
71
		if(notificationLen > 3){
72
			// Make 3rd notifictaion of 1st screen bottom border hidden
73
			$("#notification .notificationContent:eq(2) .borderBottom").hide();	
74
		}else{
75
			// Make last notifictaion of 1st screen bottom border hidden
76
			$("#notification .notificationContent:last .borderBottom").hide();	
77
		}
78
 
79
		// Show notification container
80
		$('#notification').fadeIn("fast");
81
 
82
		closeClickCount = 0;
83
	}
84
}
85
 
86
/*
87
 * Reset Notification
88
*/
89
function resetNotification(){
90
	// Reset all notification and bottom border visible state to visible that were hidden earlier
91
 
92
	$("#notification .notificationContent:eq(0)").show();
93
	$("#notification .notificationContent:gt(0)").show();
94
 
95
	$("#notification .notificationContent:eq(0) .borderBottom").show();
96
	$("#notification .notificationContent:gt(0) .borderBottom").show();
97
}