Planning to put an scrollable gallery online with lightbox. I have encounter an error, one of my code have unexpected ” : “, expected one of: “}” , ” ” , ATTR
Using CMS Made Simple.
for cmsms error, it display
At line 702 in file /xxx/xxx/public_html/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php
This is the code i plan to put on my website.
http://sorgalla.com/jcarousel/
I will post my error here and my full script after that.
Error code.
jQuery("#gallery-prev").click(function(){
if(jQuery("#gallery").position().left < 0 && !jQuery("#gallery").is(":animated")){
jQuery("#gallery").animate({left : "+=" + imageWidth + "px"});
}
return false;
});
Full code.
<script type="text/javascript">
$(window).load(function(){
// Gallery
if(jQuery("#gallery").length){
// Fancybox
jQuery("#gallery li a").fancybox({
'titleShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});
// Variables aren't use properly due to Webkit
var totalImages = jQuery("#gallery > li").length,
imageWidth = jQuery("#gallery > li:first").outerWidth(true),
totalWidth = imageWidth * totalImages,
visibleImages = Math.round(jQuery("#gallery-wrap").width() / imageWidth),
visibleWidth = visibleImages * imageWidth,
stopPosition = (visibleWidth - totalWidth);
jQuery("#gallery").width(totalWidth);
jQuery("#gallery-prev").click(function(){
if(jQuery("#gallery").position().left < 0 && !jQuery("#gallery").is(":animated")){
jQuery("#gallery").animate({left : "+=" + imageWidth + "px"});
}
return false;
});
jQuery("#gallery-next").click(function(){
if(jQuery("#gallery").position().left > stopPosition && !jQuery("#gallery").is(":animated")){
jQuery("#gallery").animate({left : "-=" + imageWidth + "px"});
}
return false;
});
}
});
</script>
appreciate for all help.
thanks
You seem to be using smarty, and the problem is that smarty is getting confused with the opening/closing brackets {}. Try to surround the script with smarty’s {literal} tag, ie.:
Also, if you’re using smarty 3, it will probably work without the literal tag, by just adding a space after every “{” and before every “}”