Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-23-2012, 02:07 PM   PM User | #1
thegreatescape
New to the CF scene

 
Join Date: Jan 2012
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
thegreatescape is an unknown quantity at this point
Simulate the dropdown alert bar & noise of "flash update required"

Hi,

I want to recreate the effect of the drop-down bar that appears at the top of your browser when prompted to download an updated version of flash. Its for a proprietory plugin, but can't seem to get anywhere with it... Anyone have any ideas?
thegreatescape is offline   Reply With Quote
Old 01-23-2012, 03:01 PM   PM User | #2
Rowsdower!
Senior Coder

 
Rowsdower!'s Avatar
 
Join Date: Oct 2008
Location: Some say it's everything.
Posts: 2,007
Thanks: 5
Thanked 395 Times in 388 Posts
Rowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura about
What do you have so far? Let's start with the HTML/CSS even, if you don't have any javascript written yet...
__________________
The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
See Mediocrity in its Infancy
It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
Seek and you shall find... basically:
validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting
Rowsdower! is offline   Reply With Quote
Users who have thanked Rowsdower! for this post:
thegreatescape (01-23-2012)
Old 01-23-2012, 10:38 PM   PM User | #3
thegreatescape
New to the CF scene

 
Join Date: Jan 2012
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
thegreatescape is an unknown quantity at this point
Quote:
Originally Posted by Rowsdower! View Post
What do you have so far? Let's start with the HTML/CSS even, if you don't have any javascript written yet...
Hi thanks for responding.

https://shopplugin.net/ so essentially I would like to have:

this:
thegreatescape is offline   Reply With Quote
Old 01-23-2012, 11:13 PM   PM User | #4
Krupski
Regular Coder

 
Krupski's Avatar
 
Join Date: Dec 2010
Location: United States of America
Posts: 502
Thanks: 39
Thanked 47 Times in 46 Posts
Krupski is on a distinguished road
Quote:
Originally Posted by thegreatescape View Post
Hi,

I want to recreate the effect of the drop-down bar that appears at the top of your browser when prompted to download an updated version of flash. Its for a proprietory plugin, but can't seem to get anywhere with it... Anyone have any ideas?
Here ya go....

Code:
/**
 * creates an info bar at the top of the browser
 **/
function infoBar(text) {
    var b = document.body;
    var d = document.createElement('div');
    var p = viewPortInfo();
    d.style.width = String(p.width + 'px');
    d.style.height = '16px';
    d.style.color = '#000000';
    d.style.backgroundColor = '#ffffe1';
    d.style.border = '1px solid #666666';
    d.style.position = 'absolute';
    d.style.top = '0px';
    d.style.left = '0px';
    d.style.padding = '6px';
    d.innerHTML = text;
    b.appendChild(d);
}

/***
 * get client browser window size and position
 * returns a number (no 'px' suffix).
 **/
function viewPortInfo () {
    if (document.documentElement) {
        return {
            height : Math.round(document.documentElement.clientHeight),
            width : Math.round(document.documentElement.clientWidth),
            top : Math.round(document.documentElement.scrollTop),
            left : Math.round(document.documentElement.scrollLeft)
        }
    } else {
        return false;
    }
};
__________________
"Anything that is complex is not useful and anything that is useful is simple. This has been my whole life's motto." -- Mikhail T. Kalashnikov
Krupski is offline   Reply With Quote
Users who have thanked Krupski for this post:
thegreatescape (01-29-2012)
Old 01-29-2012, 08:03 PM   PM User | #5
thegreatescape
New to the CF scene

 
Join Date: Jan 2012
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
thegreatescape is an unknown quantity at this point
Quote:
Originally Posted by Krupski View Post
Here ya go....

Code:
/**
 * creates an info bar at the top of the browser
 **/
function infoBar(text) {
    var b = document.body;
    var d = document.createElement('div');
    var p = viewPortInfo();
    d.style.width = String(p.width + 'px');
    d.style.height = '16px';
    d.style.color = '#000000';
    d.style.backgroundColor = '#ffffe1';
    d.style.border = '1px solid #666666';
    d.style.position = 'absolute';
    d.style.top = '0px';
    d.style.left = '0px';
    d.style.padding = '6px';
    d.innerHTML = text;
    b.appendChild(d);
}

/***
 * get client browser window size and position
 * returns a number (no 'px' suffix).
 **/
function viewPortInfo () {
    if (document.documentElement) {
        return {
            height : Math.round(document.documentElement.clientHeight),
            width : Math.round(document.documentElement.clientWidth),
            top : Math.round(document.documentElement.scrollTop),
            left : Math.round(document.documentElement.scrollLeft)
        }
    } else {
        return false;
    }
};
Hi sorry about the delay in responding. I tried using this within script tags, but literraly nothing happens??
thegreatescape is offline   Reply With Quote
Old 01-30-2012, 07:46 AM   PM User | #6
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
You need to call the script.

Code:
<body onload = "infoBar('Put your desired text here ')">
Suggest replace
d.style.width = String(p.width + 'px'); // returns 0
with
d.style.width = '200px'; // or however many pixels suit your message
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.

Last edited by Philip M; 01-30-2012 at 07:54 AM..
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
thegreatescape (01-30-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:00 PM.


Advertisement
Log in to turn off these ads.