Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Add comment explaining notification markup
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jun 14, 2017
1 parent 490dcde commit a9caa08
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/gratipay/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ Gratipay.notification = function(text, type, timeout, closeCallback) {
var type = type || 'notice';
var timeout = timeout || (type == 'error' ? 10000 : 5000);
var id = Math.random().toString(36).substring(2, 100);

// We want the notification to be fixed at the top of the page even while
// scrolling, without interfering with the heading that's already at the
// top of the page when scrolled the whole way up (logo, sign in, etc.). So
// what we do is create two notification divs. One sits behind and pushes
// the rest of the page content down, so that the header remains visible.
// The other sits in front, and is the one the user actually interacts
// with. It stays at the top of the viewport even while scrolling.

var placeholder = ['div', {'class': 'notification notification-' + type}, ['div', text]];
var dialog = ['div', {'class': 'notification notification-' + type, 'id': 'notification-'+id},
['div', text]];
Expand Down

0 comments on commit a9caa08

Please sign in to comment.