Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- (function() {
- class MyBlink extends HTMLElement {
- constructor() {
- super();
- this._speed = 250;
- }
- connectedCallback() {
- if(this.hasAttribute('speed')) {
- this._speed = this.getAttribute('speed');
- }
- this.style.visibility = 'hidden';
- let that = this;
- window.setInterval(function() {
- that.style.visibility = (that.style.visibility === 'visible') ? 'hidden' : 'visible';
- }, this._speed);
- }
- }
- customElements.define('my-blink', MyBlink);
- })();
- </script>
- </head>
- <body>
- <my-blink speed="1000">Text to blink here</my-blink>
- </body>
- </html>
Add Comment
Please, Sign In to add comment