Skip to content
This repository was archived by the owner on May 22, 2019. It is now read-only.
Open
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
72 changes: 38 additions & 34 deletions jquery.blueberry.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
height: 'auto', //reserved
hoverpause: false,
pager: true,
setheight: true,
nav: true, //reserved
keynav: true
}
Expand Down Expand Up @@ -132,49 +133,52 @@
});
}

//calculate and set height based on image width/height ratio and specified line height
var setsize = function(){
sliderWidth = $('.slides', obj).width();
cropHeight = Math.floor(((sliderWidth/imgRatio)/o.lineheight))*o.lineheight;

$('.slides', obj).css({height: cropHeight});
};
setsize();

//bind setsize function to window resize event
$(window).resize(function(){
setsize();
});



//Add keyboard navigation

if(o.setheight) {
//calculate and set height based on image width/height ratio and specified line height
var setsize = function(){
sliderWidth = $('.slides', obj).width();
cropHeight = Math.floor(((sliderWidth/imgRatio)/o.lineheight))*o.lineheight;
$('.slides', obj).css({height: cropHeight});
};
setsize();

//bind setsize function to window resize event
$(window).resize(function(){
setsize();
});
}

//Add keyboard navigation
if(o.keynav){
$(document).keyup(function(e){

switch (e.which) {

case 39: case 32: //right arrow & space

clearTimeout(obj.play);

rotate();

break;

$(document).keyup(function(e){
switch (e.which) {
case 39: case 32: //right arrow & space
clearTimeout(obj.play);
rotate();
break;

case 37: // left arrow
clearTimeout(obj.play);
next = current - 1;
rotate();

rotate();
break;
}

}
});
}

//Add previous and next nav controls
if(o.nav){
$('#next').click(function(){
clearTimeout(obj.play);
rotate();
});

$('#back').click(function(){
clearTimeout(obj.play);
next = current - 1;
rotate();
});
}

});
}
Expand Down