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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:02:44+00:00 2026-05-26T07:02:44+00:00

Possible Duplicate: Changing only y pos of background image via Jquery I want to

  • 0

Possible Duplicate:
Changing only y pos of background image via Jquery

I want to change only y-position of backournd of .nav-logo while scrolling and keeping x-position consant.
I have implemented like this but doesnot get result.
Here is my usage code

jQuery(document).ready(function($) {
a=parseFloat(-28);// valor inccial para el background 1
b=parseFloat(1);// valor inccial para el background 1

var scrollTop = $(window).scrollTop();          
var scroll_actually= new Array();// identifica los valoares del background X y  Y

$(window).scroll(function(){//this is not the cleanest way to do this, I'm just keeping it short.
    if(scrollTop>$(this).scrollTop()) // desplazamiento hacia arriba
    {
        if (getScrollTop()<=100 && getScrollTop()>=0)// identyifica cuando la posicion del background_1 esta en scroll
        {
                a=a+1;// posicion del background1 decrementa en 1 pixeles
                b=b+1;// posicion de background1 decrementa en 1 pizeles 
                $('a.qa-logo-link').css('top', +a+'px');
                $('.nav-logo a').css('background-position', -1+'px' , 0+b+'px');    // i think something is wrong here  
        }

    }scrollTop = $(this).scrollTop();});
});
function getScrollTop(){ 



   if(typeof pageYOffset!= 'undefined'){
        //most browsers
        return pageYOffset;
    }
    else{
        var B= document.body; //IE 'quirks'
        var D= document.documentElement; //IE with doctype
        D= (D.clientHeight)? D: B;
        return D.scrollTop;
    }
}

my css file is

.nav-logo a{
background:url("logo1.png") no-repeat scroll  transparent;
background-position:-1px 1px;}
  • 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-26T07:02:45+00:00Added an answer on May 26, 2026 at 7:02 am

    if you want to keep .nav-logo in a static position, use css position:fixed; or position:absolute; and give a left and top values.

    UPDATE

    updated your sample

    http://jsfiddle.net/SbuxT/9/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Changing SVG image color with javascript I'd like to change the fill
Possible Duplicate: Changing Underline color It's possible to change only line color which is
Possible Duplicate: How to replace only one parameter or fast with Jquery on Jquery
Possible Duplicate: Changing Scrollbar Position I have a div that will act like an
Possible Duplicate: Changing projection in OpenGL I want to find a way to keep
Possible Duplicate: check window open I'm using JQuery to change the URL of a
Possible Duplicate: Unable to get textfield value using jQuery I am trying to change
Possible Duplicate: changing password field to text with checkbox with jquery The code is
Possible Duplicate: changing the img src with jquery The title may make this sound
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want

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.