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

  • Home
  • SEARCH
  • 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 8248935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:21:51+00:00 2026-06-07T23:21:51+00:00

I have the following script for a thumbnail image viewer. I’ve named each thumbnail

  • 0

I have the following script for a thumbnail image viewer. I’ve named each thumbnail image and large parent image ending in thumb and large, respectively. The script replaces the large image with whatever thumbnail image is clicked on by changing the filepath.

<script>
$('.thumbs').delegate('img','click', function(){
    $('.large').attr('src',$(this).attr('src').replace('thumb','large'));
    $('.large').hide().fadeIn(500);
});
</script>

Each time a thumbnail is clicked, the page scrolls back to the top. I’ve tried to prevent this with

return false;

It works, however, then large image won’t update. Is there another way to prevent the page from scrolling to the top?

Thanks for your help.

  • 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-07T23:21:52+00:00Added an answer on June 7, 2026 at 11:21 pm

    The page does not scroll to the top of page, it scroll to the top of large image because you change the image source.

    You can try to disable and hide and fadeIn effects and see if the problem persists.

    If the problem persists simply add the following code that the issue is resolved.

    <script>
    $('.thumbs').delegate('img','click', function(){
        var y = window.pageYOffset;
        $('.large').attr('src',$(this).attr('src').replace('thumb','large'));
        $('.large').hide().fadeIn(500);
        window.scrollTo(0, y)
    });
    </script>
    

    Sorry any english mistake. I’m using google translate.

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

Sidebar

Related Questions

I have a table named users and each row (user) has an image. The
I have the following script. It replaces all instances of @lookFor with @replaceWith in
I have the following script which animates a background image sprite on my navigation
I have the following script which I need to combine together somehow. Each function
I have following script that executes all the .reg files in the current directory.
I have following small script to preview some text before submitting it to store
I have the following script below where I try to mimic a file upload
I have the following script: (function($) { $.fn.easyPaginate = function(options){ var defaults = {
I have the following script running successfully. However if I try to use a
I have the following script which first shows only the first para of the

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.