Solved

How to display a small slide popup window?

Posted on 2009-04-01
4
555 Views
Last Modified: 2012-05-06
Hi, we want to display a popup window(to show that an operation has been done) but we need this window to appear from the bottom of the window and slide up until it entirely appears.
How we can do that?
0
Comment
Question by:Abdu_Allah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 30

Assisted Solution

by:third
third earned 20 total points
ID: 24037801
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24038115
Yes exactly but I donot prefer to plugin entire JQuery, is there a sample could available?
0
 
LVL 18

Accepted Solution

by:
Morcalavin earned 480 total points
ID: 24038642
Here is a very quick example of how to accomplish something like this on your own.  This is pretty feature limited and doesn't offer a lot of options, but it should give you a place to start from.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script type="text/javascript" src="SlideUP.js"></script>
<script type="text/javascript">
var slider;
window.onload = function() {
   slider = new SlideUP({
        width: 250, //a valid width
        height: 125, //a valid height
        border: '1px solid #000000', //any valid border css declaration
        background: 'url(SlideUp.png)' //any valid background css declaration.  I used a gradient 250x125 background on mine.
    });
};
</script>
</head>
<body>
<div><button onclick="slider.show('<div style=\'text-align: center;line-height:120px\'>This is a test</div>')">Show popup</button></div>
<div><button onclick="slider.close()">Close Popup</div>
</body>
</html>

//SlideUP.js source
 
function SlideUP(options) {
    var mainWindow, mainWindowStyle;
    this.options = options;
    mainWindow = document.createElement('div');
    mainWindowStyle = mainWindow.style;
    mainWindowStyle.width = options.width + 'px';
    mainWindowStyle.height = options.height + 'px';
    mainWindowStyle.border = options.border;
    mainWindowStyle.background = options.background;
    mainWindowStyle.position = 'absolute';
    mainWindowStyle.visibility = 'hidden';
    document.body.appendChild(mainWindow);
    this.mainWindow = mainWindow;
}
 
SlideUP.prototype.show = function(text) {
    var self, mainWindow, mainWindowStyle, intervalGrow;
    self = this;
    mainWindow = this.mainWindow;
    mainWindow.innerHTML = '';
    mainWindowStyle = mainWindow.style;
    mainWindowStyle.left = (window.innerWidth || (document.documentElement.clientWidth || (document.body.clientWidth || 0))) -  this.options.width - 20 + 'px';
    mainWindowStyle.top = (window.innerHeight || (document.documentElement.clientHeight || (document.body.clientHeight || 0))) - 20 + 'px';
    mainWindowStyle.height = '0px';
    mainWindow.currentHeight = 0;
    mainWindowStyle.visibility = 'visible';
    intervalGrow = window.setInterval(function() {
        if(mainWindow.currentHeight < self.options.height) {
            mainWindowStyle.height = mainWindow.currentHeight + 'px';
            mainWindowStyle.top = parseInt(mainWindowStyle.top.split('px')[0], 10) - 4 + 'px';
            mainWindow.currentHeight+=4;
        }
        else {
            mainWindow.innerHTML = text;
            window.clearInterval(intervalGrow);
        }
    }, 10);
}
 
SlideUP.prototype.close = function() {
    this.mainWindow.style.visibility = 'hidden';
}

Open in new window

SlideUP.png
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24068059
Morcalavin, here is a question based on your slide window:
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_24294972.html
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question