I am trying to do a content slider controlled with a menu. Div elements will be placed in a wrapper and I am changing its position using script. Please check below code
jQuery(document).ready(function() {
function goto(id){
jQuery(".contentbox-wrapper").animate({"left": -(jQuery(id).position().left)}, 600);
}
});
and html where the function calling is,
<li><a href="#" onClick="goto('#homePage', this); return false">Home</a></li>
<li><a href="#" onClick="goto('#aboutPage', this); return false">About</a></li>
and the content divs is like
<div class="contentbox-wrapper">
<div id="homePage" class="contentBox">
content here
</div>
<div id="aboutPage" class="contentBox">
content here
</div>
</div>
the problem is, when i click on the menu items i am getting this error
" Uncaught ReferenceError: goto is not defined "
Please help..
.ready()callback. Move it outside. There's no need to wait for the DOM to be ready to declare your function.gotoname may not work in order browsers, since in ECMAScript 3 it was a reserved word.