forked from robflaherty/html-slideshow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 67df4af
Showing
11 changed files
with
541 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
@font-face { | ||
font-family: 'ChunkFiveRegular'; | ||
src: url('../fonts/Chunkfive-webfont.eot'); | ||
src: local('☺'), url('../fonts/Chunkfive-webfont.woff') format('woff'), url('../fonts/Chunkfive-webfont.ttf') format('truetype'), url('../fonts/Chunkfive-webfont.svg#webfont') format('svg'); | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
body{ background:#f5f6f6; } | ||
#deck h1 { font-family: 'ChunkFiveRegular', Arial; font-size:50px; text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8); } | ||
#deck h2 { font-family: 'ChunkFiveRegular', Arial; font-size: 30px; text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8); } | ||
#deck p, #deck li { font-family: Arial; font-size:20px; text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8); } |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* | ||
* HTML Slideshow | ||
* Author: Rob Flaherty | rob@ravelrumba.com | ||
*/ | ||
|
||
(function() { | ||
|
||
//Initialize variables and cache jQuery objects | ||
var currentSlide = 1, | ||
slideHash = location.hash, | ||
deck = $('#deck'), | ||
slideCount = $('#deck > section').size(), | ||
prevButton = $('#prev-btn'), | ||
nextButton = $('#next-btn'), | ||
slideNumber = $('#slide-number'); | ||
|
||
var sliderInit = function(options) { | ||
|
||
//Add ids and classes to slides | ||
$('#deck > section').each(function(index,el){ | ||
$(el).attr('id', 'slide' + (index +1)); | ||
$(el).attr('class', 'slide'); | ||
}); | ||
|
||
//Set total slide count in header | ||
$('#slide-total').html('/' + slideCount); | ||
|
||
//Check for hash and validate value | ||
if (slideHash && (parseInt((slideHash.substring(1)), 10) <= slideCount)) { | ||
currentSlide = slideHash.replace('#',''); | ||
} | ||
|
||
//Hide menubar if hideMenu === true | ||
if(options.hideMenu === true) { | ||
setTimeout(function(){ | ||
$('header').fadeTo(300,0); | ||
}, 1500); | ||
|
||
$('header').hover(function(){ | ||
$('header').fadeTo(300,1); | ||
}, | ||
function(){ | ||
$('header').fadeTo(300,0); | ||
}); | ||
} | ||
|
||
//Set initial slide | ||
changeSlide(currentSlide); | ||
|
||
}; | ||
|
||
//Main functions | ||
function changeSlide(id) { | ||
var slideID = '#slide' + id; | ||
deck.find('.slide-selected').removeClass('slide-selected'); | ||
$(slideID).addClass('slide-selected'); | ||
|
||
//Update menu bar | ||
slideNumber.html(currentSlide); | ||
|
||
//Update hash | ||
location.hash = id; | ||
|
||
//Trigger newSlide event | ||
$('html').trigger("newSlide", id); | ||
|
||
//Hide arrows on first and last slides | ||
if ((id != 1) && (id != slideCount)) { | ||
prevButton.css('visibility', 'visible'); | ||
nextButton.css('visibility', 'visible'); | ||
} else if (id == 1) { | ||
prevButton.css('visibility', 'hidden'); | ||
} else if (id == slideCount) { | ||
nextButton.css('visibility', 'hidden'); | ||
} | ||
} | ||
|
||
function prevSlide() { | ||
if (currentSlide > 1) { | ||
currentSlide--; | ||
changeSlide(currentSlide); | ||
} | ||
} | ||
|
||
function nextSlide() { | ||
if (currentSlide < slideCount) { | ||
currentSlide++; | ||
changeSlide(currentSlide); | ||
} | ||
} | ||
|
||
function showActions() { | ||
var actions = $('.slide-selected').find('.action'); | ||
|
||
//If actions exist | ||
if (actions.length > 0) { | ||
actions.first().removeClass('action').addClass('action-on').fadeIn(250); | ||
|
||
//Number of current action | ||
var actionOns = $('.slide-selected').find('.action-on'), | ||
actionNumber = actionOns.length; | ||
|
||
//Trigger newAction event | ||
$('html').trigger("newAction", actionNumber ); | ||
} else { | ||
nextSlide(); | ||
} | ||
} | ||
|
||
//Keyboard controls | ||
function keyControls(event) { | ||
switch(event.keyCode) { | ||
//Left and up keys | ||
case 37: | ||
case 38: | ||
prevSlide(); | ||
break; | ||
//Right, down, and spacebar keys | ||
case 32: | ||
case 39: | ||
case 40: | ||
showActions(); | ||
break; | ||
} | ||
} | ||
|
||
//Control events | ||
prevButton.bind('click', prevSlide); | ||
nextButton.bind('click', nextSlide); | ||
$('html').bind('keydown', keyControls); | ||
|
||
//Do our business when the DOM is ready | ||
$(function(){ | ||
sliderInit({hideMenu: true}); | ||
}); | ||
|
||
})(); |
Oops, something went wrong.