Hi guys,
I’m trying to get a background-image swapping jQuery script to work in MODx but no luck so far. You can see how it *should* work on a static page here:
http://www.abeldesign.com/halltoll/konferanse.html
If you click on the 1-4 icons in the bottom right it swaps the background image, which is what I want. However, when i try this within MODx, it redirects the site to the home page. The code is thus:
$(".bgSwapper1").click(function(){
$(’.konferansePage #contentWrapper’).css(’background-image’, ’url(img/konferansePage_bg.jpg)’); return false;
});
$(".bgSwapper2").click(function(){
$(’.konferansePage #contentWrapper’).css(’background-image’, ’url(img/konserterPage_bg.jpg)’); return false;
});
$(".bgSwapper3").click(function(){
$(’.konferansePage #contentWrapper’).css(’background-image’, ’url(img/barPage_bg.jpg)’); return false;
});
$(".bgSwapper4").click(function(){
$(’.konferansePage #contentWrapper’).css(’background-image’, ’url(img/restaurantPage_bg.jpg)’); return false;
});
For some reason beyond my (limited) comprehension, the
return false is not working for the image swap functions when in MODx, although it actually DOES work on the other function on the page which you can see if you click the little yellow arrow at top right of the red overlay section:
$(".slideToggle").click(function(){
$(".hideSlide").slideToggle("slow");
$(this).toggleClass("toggy"); return false;
});
I have no idea why it should work in the latter but not the former. Maybe I’m missing something massively obvious (probably) but if anyone could help me I’d be very grateful.
Cheers,
Rik