ok I'm trying to blend 2 things and for some reason it doesn't work. First off I am using Jcarousel
With this plugin there is a "start" position that you can set. So if I go ahead and put:
jQuery("#mycarousel").jcarousel({
scroll: 1,
start: 3,
initCallback: mycarousel_initCallback,
// This tells jCarousel NOT to autobuild prev/next buttons
buttonNextHTML: null,
buttonPrevHTML: null
});
Then it works perfectly by going directly to the third slide. Now I want to get that start position from querystring so I looked up and in here i found this: How can I get query string values in JavaScript?
So great with that function I can get the querystring and apply it to the "start" correct? well not that easy.
Here is my code for some reason it displays the amount of slides that the querystring is returning :S
`function getParameterByName(name) {
name = name.replace(/[[]/, "\[").replace(/[]]/, "\]");
var regexS = "[\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
// Ride the carousel...
jQuery(document).ready(function() {
var startpage = getParameterByName("vista");
jQuery("#mycarousel").jcarousel({
scroll: 1,
start: startpage,
initCallback: mycarousel_initCallback,
// This tells jCarousel NOT to autobuild prev/next buttons
buttonNextHTML: null,
buttonPrevHTML: null
});
});`
Any help is much appreciated :)
Ok I have to answer it from here cause I'm still new to this page, so here's how i solved it:
jQuery(document).ready(function() {
var startpage = getParameterByName("vista");
jQuery("#mycarousel").jcarousel({
scroll: 1,
start: parseInt(startpage),
initCallback: mycarousel_initCallback,
// This tells jCarousel NOT to autobuild prev/next buttons
buttonNextHTML: null,
buttonPrevHTML: null
});
had to parseInt the value that the function was returning because it was a string and Jcarousel doesn't recognize string :)
Took me awhile with a cold :(