I am using the Supersized jQuery plugin and need to remove the last comma from the list of images so it works in IE. The Supersized plugin does not work in IE if there is a comma after the last image, this is a known issue.
I am using Business Catalyst, so this is not PHP.
This is how the list of images appear, with a trailing comma:
{image : 'melbourne.jpg'},{image : 'tunnel.jpg'},{image : 'building.jpg'},
What would be the best way to do this?
jQuery(function($){
$.supersized({
slide_interval : 3000,
transition : 1,
transition_speed : 700,
slides : [ // Slideshow Images
{module_webapps,9198,a template="/Layouts/WebApps/slide.tpl"}
]
});
});
And this is what /Layouts/WebApps/slide.tpl looks like. Basically just looping through the slider images...
{image : '{tag_bg image_value}'},
You can use regulare expression on your string like that :
var modifiedString = yourString.replace(/,\s*$/, '');
This will remove the last comma IF there is one and will also remove white space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With