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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:04:02+00:00 2026-06-12T17:04:02+00:00

Basically I saw this page THIS PAGE and if you scroll up and down

  • 0

Basically I saw this page THIS PAGE and if you scroll up and down you can see the glass of drink becoming full and empty depeing on where your scrollbar is. Any idea how this is done?

  • 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-06-12T17:04:03+00:00Added an answer on June 12, 2026 at 5:04 pm

    It’s pretty complex to do stuff like that but not particularly hard.

    First, you’ll need to manage this using something like jQuery. You got that already so good…

    The html below is a working example that assumes the user has an image:
    enter image description here

    it is 700 x 100. The code is pretty simple. Round the window’s scrollTop() value and figure the right frame offset based on the results. No need to fully explain, the code below says it all.

    <!doctype html>
    <html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Test</title>
        <meta name="viewport" content="width=device-width">
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    </head>
    <style>
    #main{position:relative;}
    .dummy{height:500px;}
    #glass{
        height:200px;
        width:100px;
        background:url(http://www.hep-g.com/glass.jpg) no-repeat;
        background-position:0 0;
    }
    </style>
    <script type="text/javascript">
    $(document).ready(function(){
        var frame = 0;
        $(window).scroll(function(){
    
            if($(window).scrollTop() % 100 < 10)
                frame = Math.floor($(window).scrollTop() / 100) * 100;
    
            if(frame > 700)
                frame = 700;
    
            $('#glass').css('background-position', '-' + frame + 'px 0');
        });
    
    });
    </script>
    <body>
        <div id="main">
            <section class="dummy">
                This is dummy content
            </section>
            <section id="glass"></section>
            <section class="dummy">
                This is dummy content
            </section>
            <section class="dummy">
                This is dummy content
            </section>
        </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just saw something very interesting in vk.com Basically in profile page the right
I saw this implemented somewhere but basically below I'm using the textbox HTMLHelper to
I saw this question and it really shedded some light. Despite this, I can't
Somewhere I saw a way to simplify ruby blocks with one argument, it basically
I saw this post Ruby on Rails - Awesome nested set plugin but I
I was looking at the 14 days of jquery http://jquery14.com/day-01/jquery-14 and I saw this
I'm writing a simple linear linked list implementation in PHP. This is basically just
<div onclick=alert(this.innerHTML);> <p>Since you saw <span title=:P class=emoticon tongue></span> if <strong>you read</strong> the intro
I saw that in Eclipse I can define User Libraries - to make setting
I saw this question, Show Open Dialog on a Button click : 'I have

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.