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

जावास्क्रिप्ट के साथ चारों ट्रांजिशन प्रॉपर्टीज कैसे सेट करें?


जावास्क्रिप्ट में transition प्रॉपर्टी का उपयोग करें, निम्न चार प्रॉपर्टीज सेट करें: transitionProperty, transitionDuration, transitionTimingFunction, और transitionDelay।

उदाहरण

जावास्क्रिप्ट के साथ चारों ट्रांजिशन प्रॉपर्टीज सेट करना सीखने के लिए निम्न कोड चलाकर देखें:

<!DOCTYPE html> <html>    <head>       <style>          #div1 {             position: relative;             margin: 10px;             height: 300px;             width: 400px;             padding: 20px;             border: 2px solid blue;          }          #div2 {             padding: 80px;             position: absolute;             border: 2px solid BLUE;             background-color: yellow;             transform: rotateY(45deg);          }          #div2:hover {             background-color: orange;             width: 50px;             height: 50px;             padding: 100px;             border-radius: 50px;          }       </style>    </head>    <body>       <p>DIV2 पर होवर करें</p>       <button onclick = "display()">सेट करें</button>       <div id = "div1">DIV1          <div id = "div2">DIV2</div>       </div>           <script>          function display() {             document.getElementById("div2").style.transition = "all 2s";          }       </script>    </body> </html>

  1. - JavaScript से फ़ॉन्ट की बोल्डनेस कैसे सेट करें?

    उदाहरण fontWeight प्रॉपर्टी से फ़ॉन्ट की मोटाई सेट करें। <!DOCTYPE html> <html> <body> <h1>हेडिंग 1</h1> <p id=myID> यह डेमो टेक्स्ट है। </p> <button type=button onclick=display()>फ़ॉन्ट परिवार और वजन सेट करें</button>

  1. - JavaScript से एलिमेंट के सभी मार्जिन्स एक साथ कैसे सेट करें?

    उदाहरण margin शॉर्टहैंड प्रॉपर्टी से चारों मार्जिन एक साथ सेट करें। <!DOCTYPE html> <html> <body> <button type=button onclick=display()>चारों मार्जिन सेट करें</button> <p id=myID>यह डेमो टेक्स्ट है।</p> <script> function display() {

  1. - JavaScript से सभी आउटलाइन प्रॉपर्टीज़ एक घोषणा में कैसे सेट करें?

    उदाहरण outline शॉर्टहैंड प्रॉपर्टी से रंग, शैली, चौड़ाई एक साथ सेट करें। <!DOCTYPE html> <html> <head> <style> #box { width: 450px; background-color: orange; border: 3px solid red; } </style> </head> <body>