Reputation: 131
$(document).ready(function(){
//image time
//hide the Section
$("#biocontent,#educontent,#expcontent,#rescontent,#mobcontent,#concontent,#gamcontent").hide();
//toggle sections
$("#bioH").click(function(){
$("#biocontent").toggle();
});
$("#eduH").click(function(){
$("#educontent").toggle();
});
$("#expH").click(function(){
$("#expcontent").toggle();
});
$("#resH").click(function(){
$("#rescontent").toggle();
});
$("#mobH").click(function(){
$("#mobcontent").toggle();
});
$("#conH").click(function(){
$("#concontent").toggle();
});
$("#gamH").click(function(){
$("#gamcontent").toggle();
});
setInterval("swapImages()", 2000);
//swap images for slideshow
function swapImages(){
var active = $("#gallery.active");
var next = ($("#gallery.active").next().length > 0) ? $("#gallery.active").next() : $("#gallery img:first");
active.removeClass("active");
next.fadeIn().addClass("active");
});
});
the question is my last function in the wrong position for it execute i aint so sure were to put another jquery function can some1 look over it :) i need to know if i have something in the wrong position cheer's
Upvotes: 1
Views: 42
Reputation: 206028
Errors:
setInterval("swapImages", 2000);
and function swapImages(){ }); <-- extra ')'
$(document).ready(function(){
//image time
//hide the Section
$("#biocontent,#educontent,#expcontent,#rescontent,#mobcontent,#concontent,#gamcontent").hide();
//toggle sections
$("#bioH").click(function(){
$("#biocontent").toggle();
});
$("#eduH").click(function(){
$("#educontent").toggle();
});
$("#expH").click(function(){
$("#expcontent").toggle();
});
$("#resH").click(function(){
$("#rescontent").toggle();
});
$("#mobH").click(function(){
$("#mobcontent").toggle();
});
$("#conH").click(function(){
$("#concontent").toggle();
});
$("#gamH").click(function(){
$("#gamcontent").toggle();
});
setInterval(swapImages, 2000);
//swap images for slideshow
function swapImages(){
var active = $("#gallery.active");
var next = ($("#gallery.active").next().length > 0) ? $("#gallery.active").next() : $("#gallery img:first");
active.removeClass("active");
next.fadeIn().addClass("active");
}
});
Anyway, without seeing your HTML I cannot help further, I just know if you used classes all that code would end up in a few lines of pure awesomeness.
Upvotes: 1
Reputation: 5930
swapImages
should be in the global (window) scope the way you have written it.
Upvotes: 0