Created
September 2, 2013 16:50
-
-
Save andregumieri/6414913 to your computer and use it in GitHub Desktop.
Verifica se um elemento HTML tem scroll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Verifica Scroll</title> | |
| <meta charset="UTF-8" /> | |
| <style type="text/css"> | |
| #lista { | |
| overflow: scroll; | |
| width: 100%; | |
| height: 100px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="lista"> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| <p>Linha</p> | |
| </div> | |
| <script type="text/javascript" src="temScroll.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var el = document.getElementById('lista'); | |
| if(el.scrollHeight>el.clientHeight) { | |
| console.log('Tem Scroll'); | |
| } else { | |
| console.log('Não tem scroll'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment