I am very new to this, but I wrote this and thought it would work first time, but I get an 'ReferenceError: Can't find variable: street' console error.
I get this error if I click on the 'Street' button.
It's quite basic but this is the first time I've made a function to use a var/ref from the onClick attribute.
Please see onClick markup...
<a href="#" title="View Supersport" onclick="bikeFilter(supersport)">Supersport</a>
<a href="#" title="View Street" onclick="bikeFilter(street)">Street</a>
<a href="#" title="View Cruiser" onclick="bikeFilter(cruiser)">Cruiser</a>
<a href="#" title="View Scooter" onclick="bikeFilter(scooter)">Scooter</a>
<a href="#" title="Motocross" onclick="bikeFilter(motocross)">Motocross</a>
<a href="#" title="Enduro" onclick="bikeFilter(enduro)">Enduro</a>
<a href="#" title="Kids" onclick="bikeFilter(kids)">Kids</a>
then please see my function, which gets the ref error above...
Also please note I am trying to use the onClick var/ref within my function so I can target specific elements relative to the button being clicked.
bikeFilter = function (y) {
$('.bike').fadeOut();
scrollTo(186);
$('.bike[data-group=' + y + ']').fadeIn();
bikeSliderNav();
bikeSlider();
return false;
}
Any expert advice would be really helpful.
Thanks in advance.