-
Notifications
You must be signed in to change notification settings - Fork 32
Durga js window objects api #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
|
|
||
| * { | ||
| margin: 0; | ||
| padding: 0; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| body { | ||
| font-family: Arial, sans-serif; | ||
| line-height: 1.6; | ||
| } | ||
|
|
||
| header { | ||
| background: #0d0a99; | ||
| color: #fff; | ||
| padding: 20px; | ||
| text-align: center; | ||
| } | ||
|
|
||
| nav ul { | ||
| list-style: none; | ||
| display: flex; | ||
| justify-content: center; | ||
| gap: 20px; | ||
| margin-top: 10px; | ||
| } | ||
|
|
||
| nav a { | ||
| color: #fff; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| main { | ||
| display: flex; | ||
| padding: 20px; | ||
| gap: 20px; | ||
| } | ||
|
|
||
| article { | ||
| flex: 3; | ||
| background: #2c13a8; | ||
| color: #fff; | ||
| padding: 20px; | ||
| border-radius: 8px; | ||
| } | ||
|
|
||
| aside { | ||
| flex: 1; | ||
| background: #4d119b; | ||
| color: #fff; | ||
| padding: 20px; | ||
| border-radius: 8px; | ||
| } | ||
|
|
||
| footer { | ||
| background: #3f12ba; | ||
| color: #fff; | ||
| text-align: center; | ||
| padding: 15px; | ||
| margin-top: 20px; | ||
| bottom: auto; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| main { | ||
| flex-direction: column; | ||
| flex:1; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>CSS Animation & Media Queries</title> | ||
| <style> | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| margin: 0; | ||
| padding: 0; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 100vh; | ||
| background: #f0f0f0; | ||
| } | ||
| .box { | ||
| width: 150px; | ||
| height: 150px; | ||
| background: #3498db; | ||
| border-radius: 10px; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| color: white; | ||
| font-weight: bold; | ||
| animation: bounce 2s infinite; | ||
| } | ||
| @keyframes bounce { | ||
| 0%, 100% { | ||
| transform: translateY(0); | ||
| } | ||
| 50% { | ||
| transform: translateY(-50px); | ||
| } | ||
| } | ||
| @media (max-width: 768px) { | ||
| .box { | ||
| width: 120px; | ||
| height: 120px; | ||
| font-size: 14px; | ||
| background: #e67e22; | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: 480px) { | ||
| .box { | ||
| width: 90px; | ||
| height: 90px; | ||
| font-size: 12px; | ||
| background: #2ecc71; | ||
| } | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="box">Hello Guys..!</div> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Browser Information - Navigation</title> | ||
| <link rel="stylesheet" href="style.css"> | ||
| </head> | ||
| <body> | ||
| <h2>🌐 Browser Navigation Example</h2> | ||
|
|
||
| <input type="text" id="urlInput" placeholder="Enter URL (e.g., https://google.com)" /> | ||
| <br> | ||
| <button id="goBtn">Go</button> | ||
| <button id="backBtn">Go Back</button> | ||
| <button id="forwardBtn">Go Forward</button> | ||
| <button id="reloadBtn">Reload</button> | ||
|
|
||
| <p id="info"></p> | ||
|
|
||
| <script src="script.js"></script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||
|
|
||||||
| document.getElementById("info").innerText = "Current URL: " + window.location.href; | ||||||
|
|
||||||
| document.getElementById("goBtn").addEventListener("click", () => { | ||||||
| const url = document.getElementById("urlInput").value.trim(); | ||||||
| if (url) { | ||||||
|
|
||||||
| window.location.assign(url); | ||||||
| } else { | ||||||
| alert("Please enter a valid URL!"); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
|
||||||
| } | ||||||
| }); | ||||||
|
|
||||||
| document.getElementById("backBtn").addEventListener("click", () => { | ||||||
| window.history.back(); | ||||||
| }); | ||||||
|
|
||||||
| document.getElementById("forwardBtn").addEventListener("click", () => { | ||||||
| window.history.forward(); | ||||||
| }); | ||||||
|
|
||||||
| document.getElementById("reloadBtn").addEventListener("click", () => { | ||||||
| window.location.reload(); | ||||||
| }); | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| text-align: center; | ||
| margin-top: 50px; | ||
| background-color: #f9f9f9; | ||
| } | ||
|
|
||
| h2 { | ||
| color: #333; | ||
| } | ||
|
|
||
| input { | ||
| padding: 10px; | ||
| width: 320px; | ||
| border: 1px solid #ccc; | ||
| border-radius: 5px; | ||
| } | ||
|
|
||
| button { | ||
| padding: 8px 15px; | ||
| margin: 5px; | ||
| cursor: pointer; | ||
| border: none; | ||
| border-radius: 5px; | ||
| background-color: #0078d7; | ||
| color: white; | ||
| font-size: 15px; | ||
| transition: background-color 0.2s; | ||
| } | ||
|
|
||
| button:hover { | ||
| background-color: #005ea6; | ||
| } | ||
|
|
||
| #info { | ||
| margin-top: 20px; | ||
| font-weight: bold; | ||
| color: #555; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
|
|
||
| function updateDimensions() { | ||
| document.getElementById("innerWidth").textContent = window.innerWidth; | ||
| document.getElementById("innerHeight").textContent = window.innerHeight; | ||
| document.getElementById("outerWidth").textContent = window.outerWidth; | ||
| document.getElementById("outerHeight").textContent = window.outerHeight; | ||
|
|
||
| document.getElementById("screenWidth").textContent = screen.width; | ||
| document.getElementById("screenHeight").textContent = screen.height; | ||
| document.getElementById("availWidth").textContent = screen.availWidth; | ||
| document.getElementById("availHeight").textContent = screen.availHeight; | ||
| document.getElementById("colorDepth").textContent = screen.colorDepth; | ||
| } | ||
|
|
||
| updateDimensions(); | ||
|
|
||
| window.addEventListener("resize", () => { | ||
| updateDimensions(); | ||
| console.log("Window resized:", window.innerWidth, "x", window.innerHeight); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| background-color: #f5f7fa; | ||
| color: #333; | ||
| text-align: center; | ||
| margin-top: 50px; | ||
| } | ||
|
|
||
| h2 { | ||
| color: #2c3e50; | ||
| } | ||
|
|
||
| #infoBox { | ||
| display: inline-block; | ||
| text-align: left; | ||
| background-color: #fff; | ||
| padding: 20px 30px; | ||
| border-radius: 10px; | ||
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); | ||
| } | ||
|
|
||
| p { | ||
| margin: 8px 0; | ||
| font-size: 16px; | ||
| } | ||
|
|
||
| strong { | ||
| color: #0078d7; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Window Dimensions</title> | ||
| <link rel="stylesheet" href="style.css"> | ||
| </head> | ||
| <body> | ||
| <h2>🖥️ Window & Screen Dimensions</h2> | ||
|
|
||
| <div id="infoBox"> | ||
| <p><strong>Inner Width:</strong> <span id="innerWidth"></span> px</p> | ||
| <p><strong>Inner Height:</strong> <span id="innerHeight"></span> px</p> | ||
| <p><strong>Outer Width:</strong> <span id="outerWidth"></span> px</p> | ||
| <p><strong>Outer Height:</strong> <span id="outerHeight"></span> px</p> | ||
| <p><strong>Screen Width:</strong> <span id="screenWidth"></span> px</p> | ||
| <p><strong>Screen Height:</strong> <span id="screenHeight"></span> px</p> | ||
| <p><strong>Available Screen Width:</strong> <span id="availWidth"></span> px</p> | ||
| <p><strong>Available Screen Height:</strong> <span id="availHeight"></span> px</p> | ||
| <p><strong>Color Depth:</strong> <span id="colorDepth"></span></p> | ||
| </div> | ||
|
|
||
| <script src="script.js"></script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| function scrollToPosition() { | ||
| const x = parseInt(document.getElementById("xInput").value) || 0; | ||
| const y = parseInt(document.getElementById("yInput").value) || 0; | ||
| window.scrollTo(x, y); | ||
| } | ||
|
|
||
| function scrollUp() { | ||
| window.scrollBy(0, -10); | ||
| } | ||
|
|
||
| function scrollDown() { | ||
| window.scrollBy(0, 10); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Scroll Example</title> | ||
| <link rel="stylesheet" href="style.css"> | ||
| </head> | ||
| <body> | ||
| <h2>Scroll to Position</h2> | ||
|
|
||
| <div class="controls"> | ||
| <label for="xInput">X:</label> | ||
| <input type="number" id="xInput" placeholder="Enter X value"> | ||
|
|
||
| <label for="yInput">Y:</label> | ||
| <input type="number" id="yInput" placeholder="Enter Y value"> | ||
|
|
||
| <button onclick="scrollToPosition()">Scroll to (X, Y)</button> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using inline |
||
| </div> | ||
|
|
||
| <div class="scroll-buttons"> | ||
| <button onclick="scrollUp()">Scroll Up 10px</button> | ||
| <button onclick="scrollDown()">Scroll Down 10px</button> | ||
| </div> | ||
|
|
||
| <div class="content"> | ||
| <p>Scroll this page to test the scrolling feature!</p> | ||
| <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</p> | ||
| <p style="margin-top:2000px;">You’ve reached the bottom!</p> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </div> | ||
|
|
||
| <script src="script.js"></script> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| padding: 20px; | ||
| line-height: 1.6; | ||
| } | ||
|
|
||
| .controls, .scroll-buttons { | ||
| margin-bottom: 20px; | ||
| } | ||
|
|
||
| input { | ||
| width: 80px; | ||
| margin: 0 10px; | ||
| padding: 5px; | ||
| } | ||
|
|
||
| button { | ||
| margin: 5px; | ||
| padding: 8px 12px; | ||
| cursor: pointer; | ||
| border: none; | ||
| background-color: #0078d7; | ||
| color: white; | ||
| border-radius: 5px; | ||
| transition: background-color 0.3s; | ||
| } | ||
|
|
||
| button:hover { | ||
| background-color: #005fa3; | ||
| } | ||
|
|
||
| .content { | ||
| height: 2500px; /* So that scrolling works */ | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CSS for this page is embedded within a
<style>tag in the HTML file. According to the best practices outlined in the PR description, it's better to move CSS to external files. This improves code organization, reusability, and maintainability by separating concerns.