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 7609903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:17:24+00:00 2026-05-31T01:17:24+00:00

Hi i have this code right now on my website… <script src=http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js type=text/javascript charset=utf-8></script>

  • 0

Hi i have this code right now on my website…

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript" charset="utf-8">
        var scrollSpeed = 50;       // Speed in milliseconds
        var step = 1;               // How many pixels to move per step
        var current = 0;            // The current pixel row
        var imageWidth = 4000;      // Background image width
        var headerWidth = screen.width;     // How wide the header is.

        //The pixel row where to start a new loop
        var restartPosition = -(imageWidth - headerWidth);

        function scrollBg(){
            //Go to next pixel row.
            current -= step;

            //If at the end of the image, then go to the top.
            if (current == restartPosition){
                current = 0;
            }

            //Set the CSS of the header.
            $('#body').css("background-position",current+"px 0");
        }

        //Calls the scrolling function repeatedly
        var init = setInterval("scrollBg()", scrollSpeed);
</script>   

I’m trying to add a second jQuery selector to:

$('#body').css("background-position",current+"px 0");

so that the css background-position property is changed for two elements.

IE 8 will not work with gradient and background so I’m using a nested div (class=”flash-bg”) with the background picture and want to update it’s background-position so that it will animate in IE as well.

How can I add “flash-bg” to the jquery code? Is there a way to just add it next to ‘#body’? Or just repeat the code except with ‘#flash-bg’? Thanks!

  • 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-31T01:17:25+00:00Added an answer on May 31, 2026 at 1:17 am

    If you want to set the background-position on both #body and .flash-bg, this will work:

    $('#body, .flash-bg').css("background-position",current+"px 0");
    

    Also, in your setInterval, you can pass a reference to the function instead of a string to be eval:ed:

    var init = setInterval(scrollBg, scrollSpeed);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code right now to get the row value from jquery grid..
Right now, I have this code where $obj_arr maybe contain array and an object.
Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName
Hey I have this code right here: http://pastie.org/534470 And on line 109 I get
I'm using this sticky footer in my website: http://www.cssstickyfooter.com/using-sticky-footer-code.html It is fully working in
I have this code which compiles and works as expected: class Right {}; class
I have this code <a href=#> <span style=border-right: medium none; class=Yes>Yes</span> </a> <a href=#>
Ok, if I have this right, my code can get cookies at a specific
I have code like this to move the player in my game left, right,
I have this code in jQuery, that I want to reimplement with the prototype

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.