Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions jquery.jshowoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ hoverPause : whether to pause on hover [boolean, defaults to true]
links : whether to create & display numeric links to each slide [boolean, defaults to true]
speed : time each slide is shown [integer, milliseconds, defaults to 3000]

Modified by Alan Richey:
- Pause animation to prevent animation from building up on window blur
- Replaced attr() with prop() to prevent undefined links
*/

(function($) {


$.fn.jshowoff = function(settings) {

// default global vars
Expand Down Expand Up @@ -98,6 +100,10 @@ speed : time each slide is shown [integer, milliseconds, defaults to 3000]
function(){ if(isPlaying()) play('hover'); }
);};

// pause slide rotation when window loses focus
var infocus = true;
$(window).focus(function(){ infocus = true; }).blur(function (){ infocus = false; });

// determine autoPlay
if(config.autoPlay && gallery.length>1) {
timer = setInterval( function(){ play(); }, config.speed );
Expand Down Expand Up @@ -158,9 +164,12 @@ speed : time each slide is shown [integer, milliseconds, defaults to 3000]

// start slide rotation on specified interval
function play(src) {
if(!isBusy()){
counter++;
transitionTo(gallery,counter);
if(!isBusy() && infocus){
if(src!='hover') {
counter++;
transitionTo(gallery,counter);
}

if(src=='hover' || !isPlaying()) {
timer = setInterval(function(){ play(); },config.speed);
}
Expand Down Expand Up @@ -228,7 +237,7 @@ speed : time each slide is shown [integer, milliseconds, defaults to 3000]
function addSlideLinks() {
$wrap.append('<p class="jshowoff-slidelinks '+uniqueClass+'-slidelinks"></p>');
$.each(gallery, function(i, val) {
var linktext = $(this).attr('title') != '' ? $(this).attr('title') : i+1;
var linktext = $(this).prop('title') != '' ? $(this).prop('title') : i+1;
$('<a class="jshowoff-slidelink-'+i+' '+uniqueClass+'-slidelink-'+i+'" href="#null">'+linktext+'</a>').bind('click', {index:i}, function(e){ goToAndPause(e.data.index); return false; }).appendTo('.'+uniqueClass+'-slidelinks');
});
};
Expand Down
6 changes: 3 additions & 3 deletions jquery.jshowoff.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.