开发者

jquery content slider jump back to top after click on hyper link

开发者 https://www.devze.com 2023-04-13 06:35 出处:网络
I am completely new to jquery and dont know anything but I am developing my 3d tutorial website and using simple jquery content slider. Everything is fine only when I click on hyper link it jump back

I am completely new to jquery and dont know anything but I am developing my 3d tutorial website and using simple jquery content slider. Everything is fine only when I click on hyper link it jump back to top of the page. I have tried out to search h开发者_JAVA技巧ere in database but I couldnt found appropriate to my need.

I have created content slider with this tutorial and use exact code http://www.webdeveloperjuice.com/2010/01/12/lightest-jquery-content-slider-ever-made-380-bytes/

Please guide me how to solve this.

Thanks a lot


You probably need to prevent default behaviour of links:

Modify these lines, passing "event" to the function and then preventing default on it:

$('#button a').click(function(event){ // added "event"
  event.preventDefault(); // this is a new line just inside function
  // rest of the script as before


your demo contains

href="#"

the # sign is assigned to the top of the page.

you should put your own labels like these in your doc

and then yo navigate by

#myCarDiv

#myGuitarDiv
0

精彩评论

暂无评论...
验证码 换一张
取 消