When in click a radio button, it scroll to the top. How to prenvent that?

3k views Asked by At

I've got a formular with radio input. when the input is on the bottom of the page and I select one, it scrolls to the top of the page.

How can this be?
How to prevent that?

I'm using d3, and formatting the radio to look like button.

3

There are 3 answers

0
julienfr112 On

I got it : to hide the round selector, the css use a trick :

position:absolute;
top:-10px;

when i click on the label, the browser scroll to the top, where the round selector is.

0
AudioBubble On

To hide the round selector there would be css like this

.radio:not(:checked) > input {
    position:absolute;
    top:-9999px;
}

It will scroll the page to top. Please change top attribute with left

.radio:not(:checked) > input {
    position:absolute;
    left:-9999px;
}
0
tae shin On

It might need a parent element that is not positioned with "static". I think your radio button positioned on top of scroll