Forum Moderators: open
<div class="next_button"><!-- NEXT BUTTON-->
<a href="javascript:void(0);" onClick="nextPicture()">Next</a>
</div><!-- END OF NEXT BUTTON --> <script type="text/javascript">
<!--
/*NEXT PICTURE */
$(document).ready(function()
{
var mainPictures = ["images/gloom_full_1", "images/gloom_full_2", "images/gloom_full_3", "images/gloom_full_4", "images/gloom_full_5", "images/gloom_full_6", "images/gloom_full_7", "images/gloom_full_8", "images/gloom_full_9", "images/gloom_full_10", "images/gloom_full_11", "images/gloom_full_12", "images/gloom_full_13", "images/gloom_full_14", "images/gloom_full_15", "images/gloom_full_16", "images/gloom_full_17", "images/gloom_full_18", "images/gloom_full_19", "images/gloom_full_20", "images/gloom_full_21", "images/gloom_full_22", "images/gloom_full_23", "images/gloom_full_24", "images/gloom_full_25", "images/gloom_full_26", "images/gloom_full_27" ];
var thumbPictures = ["images/gloom_thumb_1", "images/gloom_thumb_2", "images/gloom_thumb_3", "images/gloom_thumb_4", "images/gloom_thumb_5", "images/gloom_thumb_6", "images/gloom_thumb_7", "images/gloom_thumb_8", "images/gloom_thumb_9", "images/gloom_thumb_10", "images/gloom_thumb_11", "images/gloom_thumb_12", "images/gloom_thumb_13", "images/gloom_thumb_14", "images/gloom_thumb_15", "images/gloom_thumb_16", "images/gloom_thumb_17", "images/gloom_thumb_18", "images/gloom_thumb_20", "images/gloom_thumb_21", "images/gloom_thumb_22", "images/gloom_thumb_23", "images/gloom_thumb_24", "images/gloom_thumb_25", "images/gloom_thumb_26", "images/gloom_thumb_27"];
var thumbShadedPictures = ["images/gloom_thumb_shad_1", "images/gloom_thumb_shad_2", "images/gloom_thumb_shad_3", "images/gloom_thumb_shad_4", "images/gloom_thumb_shad_5", "images/gloom_thumb_shad_6", "images/gloom_thumb_shad_7", "images/gloom_thumb_shad_8", "images/gloom_thumb_shad_9", "images/gloom_thumb_shad_10", "images/gloom_thumb_shad_11", "images/gloom_thumb_shad_12", "images/gloom_thumb_shad_13", "images/gloom_thumb_shad_14", "images/gloom_thumb_shad_15", "images/gloom_thumb_shad_16", "images/gloom_thumb_shad_17", "images/gloom_thumb_shad_18", "images/gloom_thumb_shad_19", "images/gloom_thumb_shad_20", "images/gloom_thumb_shad_21", "images/gloom_thumb_shad_22", "images/gloom_thumb_shad_23", "images/gloom_thumb_shad_24", "images/gloom_thumb_shad_25", "images/gloom_thumb_shad_26", "images/gloom_thumb_shad_27"];
mainPictures.current = 0;
thumbPictures = 0;
thumbShadedPictures = 0;
function nextPicture()
{
$("pic_1").fadeOut(2000, function()
{
$(this).attr('src',mainPictures[1]).fadeIn(2000)
});
}
});
//-->
</head> function nextPicture() I grab the id pic_1 which is referenced in the body of the page <img src="images/gloom_full_1.jpg" alt="" id="pic_1"> and which contains the first main picture I let it fade out and I replace it with the second picture in the array, but obviously it is not working... any advice (especially if there is an easier way pls) <script type="text/javascript">
<!--
/*NEXT PICTURE */
function nextPicture()
{
var mainPictures = ["images/gloom_full_1.jpg", "images/gloom_full_2.jpg", "images/gloom_full_3.jpg", "images/gloom_full_4.jpg", "images/gloom_full_5.jpg", "images/gloom_full_6.jpg", "images/gloom_full_7.jpg", "images/gloom_full_8.jpg", "images/gloom_full_9.jpg", "images/gloom_full_10.jpg", "images/gloom_full_11.jpg", "images/gloom_full_12.jpg", "images/gloom_full_13.jpg", "images/gloom_full_14.jpg", "images/gloom_full_15.jpg", "images/gloom_full_16.jpg", "images/gloom_full_17.jpg", "images/gloom_full_18.jpg", "images/gloom_full_19.jpg", "images/gloom_full_20jpg", "images/gloom_full_21.jpg", "images/gloom_full_22.jpg", "images/gloom_full_23.jpg", "images/gloom_full_24.jpg", "images/gloom_full_25.jpg", "images/gloom_full_26.jpg", "images/gloom_full_27.jpg" ];
var thumbPictures = ["images/gloom_thumb_1.jpg", "images/gloom_thumb_2.jpg", "images/gloom_thumb_3.jpg", "images/gloom_thumb_4.jpg", "images/gloom_thumb_5.jpg", "images/gloom_thumb_6.jpg", "images/gloom_thumb_7.jpg", "images/gloom_thumb_8.jpg", "images/gloom_thumb_9.jpg", "images/gloom_thumb_10.jpg", "images/gloom_thumb_11.jpg", "images/gloom_thumb_12.jpg", "images/gloom_thumb_13.jpg", "images/gloom_thumb_14.jpg", "images/gloom_thumb_15.jpg", "images/gloom_thumb_16.jpg", "images/gloom_thumb_17.jpg", "images/gloom_thumb_18.jpg", "images/gloom_thumb_20.jpg", "images/gloom_thumb_21.jpg", "images/gloom_thumb_22.jpg", "images/gloom_thumb_23.jpg", "images/gloom_thumb_24.jpg", "images/gloom_thumb_25.jpg", "images/gloom_thumb_26.jpg", "images/gloom_thumb_27.jpg"];
var thumbShadedPictures = ["images/gloom_thumb_shad_1.jpg", "images/gloom_thumb_shad_2.jpg", "images/gloom_thumb_shad_3.jpg", "images/gloom_thumb_shad_4.jpg", "images/gloom_thumb_shad_5.jpg", "images/gloom_thumb_shad_6.jpg", "images/gloom_thumb_shad_7.jpg", "images/gloom_thumb_shad_8.jpg", "images/gloom_thumb_shad_9.jpg", "images/gloom_thumb_shad_10.jpg", "images/gloom_thumb_shad_11.jpg", "images/gloom_thumb_shad_12.jpg", "images/gloom_thumb_shad_13.jpg", "images/gloom_thumb_shad_14.jpg", "images/gloom_thumb_shad_15.jpg", "images/gloom_thumb_shad_16.jpg", "images/gloom_thumb_shad_17.jpg", "images/gloom_thumb_shad_18.jpg", "images/gloom_thumb_shad_19.jpg", "images/gloom_thumb_shad_20.jpg", "images/gloom_thumb_shad_21.jpg", "images/gloom_thumb_shad_22.jpg", "images/gloom_thumb_shad_23.jpg", "images/gloom_thumb_shad_24.jpg", "images/gloom_thumb_shad_25.jpg", "images/gloom_thumb_shad_26.jpg", "images/gloom_thumb_shad_27.jpg"];
var current_picture = 1;
mainPictures.current = 0;
thumbPictures = 0;
thumbShadedPictures = 0;
var current_picture = 1;
$("#pic_1").fadeOut(2000, function()
{
while(current_picture<mainPicture.length)
{
$("#pic_1").attr('src',mainPictures[current_picture]).fadeIn(2000);
}
current_picture++;
});
}
//-->
</script>
</head>
var p = $("#pic_1");
function doNext() {
p.fadeOut(2000, function() {
// after fade out
current_picture++;
if ( current_picture === mainPicture.length ) { current_picture=0; }
p.attr('src',mainPictures[current_picture]);
p.fadeIn(2000,doNext); // after fade in, repeat doNext
};
};
doNext(); // start process