Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> JavaScript

JavaScript में onscroll इवेंट का उपयोग क्या है?

अवलोकन

onscroll इवेंट तब होता है जब किसी तत्व का स्क्रॉलबार स्क्रॉल किया जाता है।

उदाहरण

<!DOCTYPE html> <html>    <head>       <style>          div {             border: 2px solid blue;             width: 300px;             height: 100px;             overflow: scroll;          }       </style>    </head>        <body>       <div id="content">          This is demo text. This is demo text.This is demo text.This is demo text.          This is demo text.This is demo text.This is demo text.This is demo text.          This is demo text.This is demo text.This is demo text.          This is demo text.This is demo text.This is demo text.          This is demo text.This is demo text.This is demo text.       </div>       <p id = "myScroll"> </p>       <script>          document.getElementById("content").onscroll = function() {myFunction()};          function myFunction() {             document.getElementById("myScroll").innerHTML = "Scroll successfull!.";          }       </script>    </body> </html>
  1. - JavaScript में clientX माउस इवेंट की भूमिका क्या है?

    अवलोकनclientX माउस इवेंट प्रॉपर्टी माउस पॉइंटर का क्षैतिज निर्देशांक (वर्तमान विंडो के सापेक्ष) लौटाती है।उदाहरण<!DOCTYPE html> <html>    <body>       <p onclick = "coordsFunc(event)">          Click here to get the

  1. - JavaScript में screenY माउस इवेंट की भूमिका क्या है?

    अवलोकनscreenY माउस इवेंट प्रॉपर्टी माउस पॉइंटर का लंबवत निर्देशांक (स्क्रीन के सापेक्ष) लौटाती है।उदाहरण<!DOCTYPE html> <html>    <body>       <p onclick = "coordsFunc(event)">Click here to get the x (horizontal) and y (vertical) coordinates

  1. - JavaScript में every() मेथड का उपयोग क्या है?

    अवलोकनevery() मेथड जांचता है कि क्या सरणी के सभी तत्व दी गई परीक्षण फ़ंक्शन को पास करते हैं।पैरामीटर्सcallback - प्रत्येक तत्व के लिए परीक्षण फ़ंक्शन।thisArg - कॉलबैक के लिए this मान (वैकल्पिक)।उदाहरण<html>    <head>       <title>JavaScript Array every Meth