| 1 | <html lang="en"> |
| 2 | <head> |
| 3 | <meta charset="utf-8" /> |
| 4 | <title>Test Scroll Behavior</title> |
| 5 | <script src="../../src/htmx.js"></script> |
| 6 | </head> |
| 7 | <body style="padding:20px;font-family: sans-serif"> |
| 8 | <script src="../../node_modules/sinon/pkg/sinon.js"></script> |
| 9 | <script src="../../src/htmx.js"></script> |
| 10 | <script src="../util/util.js"></script> |
| 11 | <script> |
| 12 | server = makeServer(); |
| 13 | server.autoRespond = true; |
| 14 | server.respondWith("GET", "/demo", "Clicked..."); |
| 15 | htmx.config.scrollBehavior = 'auto'; |
| 16 | </script> |
| 17 | <h1>Scrolling Start/End Tests</h1> |
| 18 | |
| 19 | <h3>End</h3> |
| 20 | <button hx-get="/demo" hx-swap="innerHTML show:#scroll-target:bottom">Scroll Bottom Of Div</button> |
| 21 | <button hx-get="/demo" hx-swap="innerHTML show:window:bottom">Scroll Bottom Of Window</button> |
| 22 | <hr/> |
| 23 | <h3>Start</h3> |
| 24 | <div id="scroll-target" style="height: 1500px; background-color: red; border: 1px solid black; scroll-margin:10px"> |
| 25 | <h1>Scroll Target</h1> |
| 26 | </div> |
| 27 | <button hx-get="/demo" hx-swap="innerHTML show:#scroll-target:top">Scroll Top Of Div</button> |
| 28 | <button hx-get="/demo" hx-swap="innerHTML show:window:top">Scroll Top Of Window</button> |
| 29 | |
| 30 | </body> |
| 31 | </html> |