0

I'm trying to create a slider with 6 images.
I've used 6 anchors. Whenever user clicks on any anchor slider image will be change accordingly and will show that particular anchor's image but the problem I'm facing is whenever user clicks on anchor, my slider move to the top of the screen because I've used ID of the images as anchor's href

Any kind of help will be appreciated!

Moon
  • 4,014
  • 3
  • 30
  • 66
  • 3
    Possible duplicate of [How to prevent a click on a '#' link from jumping to top of page?](https://stackoverflow.com/questions/3252730/how-to-prevent-a-click-on-a-link-from-jumping-to-top-of-page) –  Oct 15 '19 at 08:53
  • Any kind of code will be appreciated aswell... give us the relevant html part – MKougiouris Oct 15 '19 at 08:58
  • Sorry for bad writing I'm still learning! – Shiv Kumar Oct 16 '19 at 09:17

1 Answers1

0

Use event.preventDefault(); to stop the default action

Lets-c-codeigniter
  • 682
  • 2
  • 5
  • 18
Jakub L
  • 17
  • 2
  • event.preventDefault(); it also disables my click functionality. You can visit my site to get the clue. worthitapp[dot]com iphone slider with text around it. – Shiv Kumar Oct 16 '19 at 09:20