From 58afafa7fcc53aa922c2e8b849f43380fc71cba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20Ga=CC=8Ardebratt?= Date: Tue, 4 Sep 2012 11:53:59 +0200 Subject: [PATCH] Added option to set index of image to display first --- jquery.threesixty.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/jquery.threesixty.js b/jquery.threesixty.js index 7774e7c..a8a3f3e 100644 --- a/jquery.threesixty.js +++ b/jquery.threesixty.js @@ -18,7 +18,7 @@ jQuery.fn.threesixty = function(options){ options.direction = options.direction || "forward"; options.sensibility = options.sensibility || options.cycle * 0.35; options.autoscrollspeed = options.autoscrollspeed || 500; - + options.displayImage = options.displayImage || -1; // Image index to start with if (options.direction == "backward") options.images.reverse(); @@ -59,11 +59,23 @@ jQuery.fn.threesixty = function(options){ $.each(options.images, function(index, record) { var o =$("").attr("src",record).load(function() { - if (index>pic.data("tempIndex")) + + // Check if a disired image to start with is defined + if ((options.displayImage > -1) && (index === options.displayImage)) + { + pic.attr("src", $(this).attr("src")) + } + else if ((index>pic.data("tempIndex")) && (options.displayImage === -1)) { - pic.data("tempIndex", index) - pic.attr("src", $(this).attr("src")) + pic.data("tempIndex", index) + pic.attr("src", $(this).attr("src")) } + else if (index>pic.data("tempIndex")) + { + pic.data("tempIndex", index); + } + + var progress = pic.parent().find(".progressBar"); totalProgress++;