1

Using Slimbox 2 to view slideshows for a training site. I need to capture the length of time from when they open the slideshow until they close it. User clicks on a link which opens Slimbox to view the slideshow. After viewing all the slides, they either click on the close button or on the overlay to close Slimbox. The time elapsed will need to be put into a PHP session that will then be read by the test page. How would I detect when Slimbox is closed? Below is the code currently used to view the slideshow. Any help is greatly appreciated.

$(document).ready(function() {

$("#slideshow").live('click',function(event){

var ratio = 1500 / 1125;
var viewportWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;

if  (viewportWidth / viewportHeight > ratio) {
 sheight = viewportHeight *.9;
 swidth = viewportHeight * ratio *.9;
} else {
 swidth = viewportWidth *.9;
 sheight = viewportWidth / ratio *.9;
}
$.slimbox([["images/Slide1.JPG"], ["images/Slide2.JPG"], ["images/Slide3.JPG"]], 0, {slideWidth: + swidth, slideHeight: + sheight});
event.preventDefault();
});
});
mahoney
  • 100
  • 7

1 Answers1

0

My first thought would be to store a series of timestamps startSlide1, startSlide2, etc. in JavaScript, and then to pass that data to the test page you mentioned. I'm assuming the test page is a separate page. If this is not the case, you could simply call out to a PHP script with AJAX and get your data processed that way.

Andrew Kozak
  • 1,631
  • 2
  • 22
  • 35