From 513827e128bc258d5bad1b455fb8af494223717f Mon Sep 17 00:00:00 2001 From: Isaac Bythewood Date: Sat, 23 Feb 2013 06:28:02 +0000 Subject: [PATCH] Some lightbox improvements --- pinry/static/css/lightbox.css | 23 +++++++++++++++++++++++ pinry/static/js/lightbox.js | 15 ++++++++++----- pinry/templates/pins/recent_pins.html | 16 +++++++++++++++- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/pinry/static/css/lightbox.css b/pinry/static/css/lightbox.css index 9d01822..81162bb 100644 --- a/pinry/static/css/lightbox.css +++ b/pinry/static/css/lightbox.css @@ -4,9 +4,32 @@ left: 0; right: 0; position: absolute; + z-index: 9001; } .lightbox-wrapper { + border: 1px solid #bbb; position: absolute; left: 50%; } + + .lightbox-data { + background: white; + } + + .lightbox-data .avatar img { + width: 40px; + height: 40px; + padding: 5px; + } + + .lightbox-data .text { + margin-top: 3px; + font-size: 18px; + font-weight: bold; + } + + .lightbox-data .text .dim { + color: #999; + font-size: 14px; + } diff --git a/pinry/static/js/lightbox.js b/pinry/static/js/lightbox.js index 2370f3e..83e1267 100644 --- a/pinry/static/js/lightbox.js +++ b/pinry/static/js/lightbox.js @@ -2,20 +2,20 @@ $(window).load(function() { window.lightbox = function(pins) { var links = pins.find('.lightbox'); - function createBox(imageUrl) { + function createBox(boxData) { var template = Handlebars.compile($('#lightbox-template').html()); - var html = template({image: imageUrl}); + var html = template(boxData); $('body').append(html); $('.lightbox-wrapper img').load(function() { $('.lightbox-background').css('height', String($(document).height())+'px'); $(this).css({ 'max-width': String($(window).width()-200)+'px', - 'max-height': String($(window).height()-200)+'px', - 'margin-top': String($(window).scrollTop()+100)+'px' + 'max-height': String($(window).height()-300)+'px', }); var width = $(this).width(); $('.lightbox-wrapper').css({ + 'margin-top': String($(window).scrollTop()+100)+'px', 'margin-left': '-'+String(width/2)+'px' }); }); @@ -27,7 +27,12 @@ $(window).load(function() { link = links.eq(i); link.off('click'); link.click(function(e) { - var box = createBox($(this).attr('href')); + var box = createBox({ + image: $(this).attr('href'), + gravatar: $(this).data('gravatar'), + username: $(this).data('username'), + tags: $(this).data('tags').split(',') + }); box.click(function() { box.remove() }); diff --git a/pinry/templates/pins/recent_pins.html b/pinry/templates/pins/recent_pins.html index 24e2a68..62095f4 100644 --- a/pinry/templates/pins/recent_pins.html +++ b/pinry/templates/pins/recent_pins.html @@ -18,6 +18,20 @@