FULL STACK   ·   UI   ·   UX   ·   GRAPHICS   ·   DEVELOPER   ·   INSTRUCTOR

Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Peekaboo Box Tutorial Scroll Bottom CSS Transition Animation

Published :
Author :
Adam Khoury
Learn to program animated HTML Peekaboo boxes using CSS transitions that are triggered using only one line of JavaScript. The Peekaboo box can animate into the web page at any desired scroll point. A good understanding of scroll event programming in JavaScript enabled me to write this functionality in just a few minutes. <!DOCTYPE html> <html> <head> <style> div#peekaboo{ position:fixed; bottom:0px; right:-352px; background: #C4E6FF; padding:25px; width:300px; height:200px; font-size:48px; } </style> <script> function yScrollHandler(){ var win = document.getElementById("peekaboo"); if((window.pageYOffset + window.innerHeight) >= document.body.offsetHeight){ //win.style.webkitTransition = "right 0.7s ease-in-out 0s"; win.style.transition = "right 0.7s ease-in-out 0s"; win.style.right = "0px"; } else { win.style.transition = "right 0.7s ease-in-out 0s"; win.style.right = "-452px"; } } window.onscroll = yScrollHandler; </script> </head> <body> <h2>Scroll Bottom Y Handler Function</h2> <p style="height:1600px; font-size:18px;"> Scroll to the bottom of the page to see a Peekaboo box effect &darr; </p> <div id="peekaboo">Peekaboo!</div> </body> </html>