Guest User

Untitled

a guest
Jan 16th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. (function() {
  5. class MyBlink extends HTMLElement {
  6. constructor() {
  7. super();
  8. this._speed = 250;
  9. }
  10. connectedCallback() {
  11. if(this.hasAttribute('speed')) {
  12. this._speed = this.getAttribute('speed');
  13. }
  14. this.style.visibility = 'hidden';
  15. let that = this;
  16. window.setInterval(function() {
  17. that.style.visibility = (that.style.visibility === 'visible') ? 'hidden' : 'visible';
  18. }, this._speed);
  19. }
  20. }
  21. customElements.define('my-blink', MyBlink);
  22. })();
  23. </script>
  24. </head>
  25. <body>
  26. <my-blink speed="1000">Text to blink here</my-blink>
  27. </body>
  28. </html>
Add Comment
Please, Sign In to add comment