Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok, here's something for you to play with :-)</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; #banner { position: absolute; width: 100%; left: 0; } .banner-content { width: 400px; height: 200px; margin: 0 auto; background: green; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="banner"&gt; &lt;div class="banner-content"&gt;text &lt;a href="http://google.com"&gt;Yes&lt;/a&gt; &lt;a href="#" onclick="Banner.hide();return false"&gt;No&lt;/a&gt; &lt;/div&gt; &lt;div&gt; &lt;script type="text/javascript"&gt; var Banner=(function(){return{ init: function(){ this.ban = document.getElementById('banner'); this.ban.style.top=-this.ban.offsetHeight; this.targetY=400; this.speed=15; // increase this to slide faster this.delay=15; // decrease to slide faster this.show(); } ,show: function(){ var self=this; this.anim=setInterval(function(){ self.slideDown() }, this.delay); } ,hide: function(){ var self=this; this.anim=setInterval(function(){ self.slideUp() }, this.delay); } ,close: function(){ this.ban.style.display='none'; } ,slideDown: function(){ var banSt = this.ban.style, banTop=parseInt(banSt.top.replace(/px/,'')), banH=this.ban.offsetHeight; if ((banTop+banH)&lt;this.targetY) this.ban.style.top = banTop+this.speed; else clearInterval(this.anim); } ,slideUp: function(){ var banSt = this.ban.style, banTop=parseInt(banSt.top.replace(/px/,'')), banH=this.ban.offsetHeight; if ((banTop+banH)&gt;0) this.ban.style.top = banTop-this.speed; else clearInterval(this.anim); } }}()) window.onload=Banner.init() &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload