popup slide effect with only javascript

If you want the nice slide animation effect with javascript. you can use following javascript. Here I am not using any third party javascript library for creating the slide effect. Slide effect with popup you can achieve with only javascript.

popup slide effect with only javascript

For In page popup slide effect you can use following JavaScript code.


<div id="popup-container" style="height:200px;weight:200px;overflow: hidden; display: block; position: absolute; z-index: 1027;">

<a href="#" onclick="movead();" ><span>slide</span></a>

</div>

and use the following javscript code in your document.

[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]


function movead(){
timerID = setInterval("mocontainer()", 50);
}

function mocontainer(){
 var popup_element = document.getElementById('popup-container');
 animate_moveit(popup_element,0,-5);
}

function animate_moveit(obj, x, y){
obj.style.left = parseInt(obj.style.left) + x +"px"
obj.style.top = parseInt(obj.style.top)+ y + "px"
}

[/viral-lock]

For changing the slide direction change the values in following line and put in to the mocontainer function

animate_moveit(popup-element,-5,0);  – this is for right to left

animate_moveit(popup-element,0,-5);  – bottom to top

You can change that to as per need.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “popup slide effect with only javascript”

Leave a Reply

Your email address will not be published.