Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed Sep 29, 2018
1 parent 5cf10da commit c80cb8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion reusable.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
font-weight: inherit;
color: white;
background: rgba(0,0,0,.4);
text-shadow: 0 -.05em .1em black;
text-shadow: 0 .05em .1em rgba(0,0,0,.3);
white-space: nowrap;
}

Expand Down
19 changes: 12 additions & 7 deletions slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,22 @@ var _ = window.SlideShow = function() {
}

// Set data-title attribute to the title of the slide
if(!slide.title) {
var title = slide.title || slide.getAttribute("data-title");

if (title) {
slide.removeAttribute('title');
}
else {
// no title attribute, fetch title from heading(s)
var heading = $('hgroup', slide) || $('h1,h2,h3,h4,h5,h6', slide);

if(heading && heading.textContent.trim()) {
slide.setAttribute('data-title', heading.textContent);
title = heading.textContent;
}
}
else {
// The title attribute is set, use that
slide.setAttribute('data-title', slide.title);
slide.removeAttribute('title');

if (title) {
slide.setAttribute('data-title', title);
}

slide.setAttribute('data-index', i);
Expand Down Expand Up @@ -308,6 +312,7 @@ _.prototype = {
}

switch(evt.type) {

/**
Keyboard navigation
Ctrl+G : Go to slide...
Expand Down Expand Up @@ -356,7 +361,7 @@ _.prototype = {
Ctrl + Down/Left arrow : Previous slide
(Shift instead of Ctrl works too)
*/
if(evt.target === body || evt.target === body.parentNode || evt.metaKey && evt.altKey) {
if(evt.target === body || evt.target === body.parentNode || evt.altKey) {
if(evt.keyCode >= 32 && evt.keyCode <= 40) {
evt.preventDefault();
}
Expand Down

0 comments on commit c80cb8a

Please sign in to comment.