Skip to content

Commit 2035f98

Browse files
author
Kura
committed
Update alt and titles for opening
1 parent e05a2a6 commit 2035f98

File tree

3 files changed

+34
-26
lines changed

3 files changed

+34
-26
lines changed

README.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,26 +193,28 @@ Basic CSS for Lightbox
193193
.. code-block:: css
194194
195195
.lightbox {
196-
display: none;
197-
position: fixed;
198-
z-index: 999;
199-
width: 100%;
200-
height: 100%;
201-
text-align: center;
202-
top: 0;
203-
left: 0;
204-
background: rgba(0, 0, 0, 0.8);
196+
display: none;
197+
position: fixed;
198+
z-index: 999;
199+
width: 100%;
200+
height: 100%;
201+
text-align: center;
202+
top: 0;
203+
left: 0;
204+
right: 0;
205+
bottom: 0;
206+
background: rgba(0,0,0,0.8);
205207
}
206208
207209
.lightbox img {
208-
max-width: 98%;
209-
max-height: 90%;
210-
margin-top: 2%;
210+
max-width: 98%;
211+
max-height: 90%;
212+
margin-top: 2%;
211213
}
212214
213215
.lightbox:target {
214-
outline: none;
215-
display: block;
216+
outline: none;
217+
display: block;
216218
}
217219
218220
.lightbox-divider {

__init__.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,26 @@ def run(self):
8383
align = 'left'
8484

8585
if alt is not None:
86-
alt_html = ' alt="{}"'.format(alt)
87-
title_html = ' title="{}"'.format(alt)
86+
alt_text = '{} (click to view large image)'.format(alt)
87+
else:
88+
alt_text = '(click to view large image)'
8889

8990
if caption is not None:
90-
caption_block = '<p class="align-{}">{}</p>'.format(align, caption)
91+
caption_block = ('''<p class="align-{}">{} (click to view large '''
92+
'''image)</p>''').format(align, caption)
9193
else:
92-
caption_block = ''
93-
94-
block = ('''<div class="lightbox-block align-{5}">'''
95-
'''<a href="#{0}"{4}>'''
96-
'''<img src="{1}"{3} class="align-{5}" /></a>'''
97-
'''<a href="#_" class="lightbox" id="{0}" title="Click to close">'''
98-
'''<img alt="Click to close" src="{2}" /></a>{6}</div>'''
94+
caption_block = ('''<p class="align-{}">(click to view large '''
95+
'''image)</p>''').format(align)
96+
97+
block = ('''<div class="lightbox-block align-{4}">'''
98+
'''<a href="#{0}" title="{3}">'''
99+
'''<img src="{1}" alt="{3}" class="align-{4}" /></a>'''
100+
'''<a href="#_" class="lightbox" id="{0}" title="Click to '''
101+
'''close">'''
102+
'''<img alt="Click to close" src="{2}" /></a>{5}</div>'''
99103
'''<div class="lightbox-divider">'''
100-
'''</div>''').format(uuid, thumb, large, alt_html, title_html,
101-
align, caption_block)
104+
'''</div>''').format(uuid, thumb, large, alt_text, align,
105+
caption_block)
102106
return [nodes.raw('', block, format='html'), ]
103107

104108

lightbox.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
text-align: center;
88
top: 0;
99
left: 0;
10+
right: 0;
11+
bottom: 0;
1012
background: rgba(0,0,0,0.8);
1113
}
1214

0 commit comments

Comments
 (0)