Uncheck by scrolling through the page

Asked 1 years ago, Updated 1 years ago, 99 views

I have a question about HTML&CSS, JavaScript.

I would like to uncheck input when I create a menu for my smartphone in HTML&CSS and JavaScript and scroll through the page.
I detected a scroll in JavaScript and tried to uncheck it, but I couldn't.

Please tell me what's wrong.

HTML

<input type="checkbox" id="check"/>

JavaScript

if(1<$(this).scrollTop()){
  if(!$('#check') .prop('checked'))){
    $('#check').prop('checked', false);
  }
}

That's the code.If necessary, write down the CSS as well.

javascript jquery

2022-09-30 21:48

1 Answers

If the Javascript you gave me gets the amount of scrolling and the scroll is greater than 1,
It's supposed to be unchecked, but
Critical "sensing scrolling" has not been achieved.

Use onscroll to detect.

// For example, if you want to detect the scrolling of the window,
window.onscroll=function(e){
  // Here's what to do when a scroll event fires
};


2022-09-30 21:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.