I have a carousel that I can change the location of with an integer value.
What I’d like to do is take the hash, remove the # symbol and store that value in a variable which I can later use in a function.
I’ve pasted the code below, which for some reason just won’t work.
var $hash = window.location.hash;
if($hash != ''){
var $grave_nr = $hash.substring(1);
return $grave_nr;
} else{
var $grave_nr = 1;
return $grave_nr;
}
// carousel
$('#the_graves_carousel').tinycarousel({
intervaltime: 7000,
pager: true,
duration: 1600,
start: $grave_nr
});
Anyone have an idea why it’s not working?
EDIT: fixed it by removing the return $grave_nr; in the if statements 🙂
1 Answer