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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:46:02+00:00 2026-05-17T21:46:02+00:00

I’m wondering if this could be achieved. I know how to get the top

  • 0

I’m wondering if this could be achieved.

I know how to get the top 10 from my database using SQL. But I would like to take it a step further.

My idea is to update the DIV every couple of seconds. First the script will check if there are any updates in the database, if so the DIV should be updated. I can do this on my own, but my question is: Can I animate this using jQuery?

Example:
[code]
Top 10 know is
1. Product 1 Views: 49
2. Product 2 Views: 48
3. Product 3 Views: 34
etc…

Top 10 in a few seconds is
1. Product 2 Views: 52
2. Product 1 Views: 49
3. Product 4 Views: 35
[/code]

So now I would like to FadeOut product 1, move product 2 up, fadeIn product 1 on position 2….the same will happen to the rest of the top 10.

I don’t know if this is even possible, that’s why I’m asking here.

Thanks a lot!

  • 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-17T21:46:02+00:00Added an answer on May 17, 2026 at 9:46 pm

    Moon, it’s certainly possible, but perhaps not entirely trivial. It’s very similar to the challenge that I had in my CMS when doing a promote/demote function for articles. In that case, if a user chose to demote an item, say from #4 to #5, the first step was to get the value and do the change via Ajax. Part two was to determine the id of the value below, and promote it up, again via Ajax. The trick was to determine the two on the fly via Ajax to minimize the hits on the database.

    Now, in your case there’s an extra step, which is that an element theoretically could jump several places up or down, where in my case it was always only up one/down one. So, I think the trick would be to give the system awareness of the current pattern of results, and upon change provide it with the new set to do comparisons. During this comparison process is where the fading, blinking, etc would occur.

    So, from a practical standpoint, I’d start with a query that returned an array. On update, you could return a similar array with updated data. Using array functions, you could compare position from the first set of data, descending from items 1-X (in a foreach loop) If the item has dropped, you fade it out and into the appropriate div. If the item moves up, you’d assign it to the higher div. A good visual might be to first go from a background color to dark (or gray) and then do a slow fade out for effect. Since only one item at a time can be in a div, the new item would essentially “bump” the next item, so it would be important to insure that each item is re-assigned so it doesn’t just disappear.

    I’d be worried about doing this every few seconds…that’s a lot of DB hits and the Javascript would be pushing the client’s browser pretty hard. Maybe every 10-15 seconds would be more appropriate.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
I would like to count the length of a string with PHP. The string
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I have a view passing on information from a database: def serve_article(request, id): served_article
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.