Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 970695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:50:45+00:00 2026-05-16T02:50:45+00:00

I am working on some JS to display a Twitter-eque error/success banner. I would

  • 0

I am working on some JS to display a Twitter-eque error/success banner. I would like the banner to be visible at the top of the browser (FF, Chrome, Safari) for the duration of the time it is in view (including if the user decides to scroll somewhere else). I can’t figure out the solution however.

Another issue I am having is with jQuery not appending a passed in message to the #alert div I am using for all of this.

var alertBanner = function(msg){
    var $alert = $('#alert');
    if($alert.length) {
        $('#alert').empty();
        $(msg).appendTo('#alert');
        var alerttimer = window.setTimeout(function () {
            $alert.trigger('click');
        }, 3000);
        $alert.animate({height: $alert.css('line-height') || '50px'}, 200)
        .click(function () {
            window.clearTimeout(alerttimer);
            $alert.animate({height: '0'}, 200);
        });
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:50:45+00:00Added an answer on May 16, 2026 at 2:50 am

    For top bar use this CSS:

    #alert{
     position:fixed;
     top:0px;
     left:0px;
     width:100%;
     height:50px;
     padding:5px;
    }
    

    Now create a div like this giving it the id alert:

    <div id="alert">I am a top bar !!</div>
    

    For jQuery:

    Instead of:

    $(msg).appendTo('#alert');
    

    Use:

    $('#alert').html(msg);
    

    Or use the text for text-only message.

    More Info:

    • http://api.jquery.com/html/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to display some memory statistics (working set, GCs etc.) on a
I'm a PHP newbie working a some scripts to display some news articles from
I am working on a Rails 3 application and need to display some test
I am trying to display some message in span. but it is not working.
Working with python interactively, it's sometimes necessary to display a result which is some
I am working on to create a web site to display some information about
I'm working on a responsive design and I have some display <h3> tags that
I'm working on a site that uses JQuery UI to display some tabs and
I'm working on a Grails application and I need to display some reports and
I am currently working on a project about taxis. I want to display some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.