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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:15:03+00:00 2026-05-16T22:15:03+00:00

So there are a few things I want to do. I have a section

  • 0

So there are a few things I want to do. I have a section of HTML that I would like to be displayed on the page by default (i.e. the first time it loads).

<div class="viewport">
        <ul class="overview">           
            <li><img src="images/1.png" /></li>
            <li><img src="images/2.png" /></li>
            <li><img src="images/3.png" /></li>         
            <li><img src="images/4.png" /></li>
            <li><img src="images/5.png" /></li>
            <li><img src="images/6.png" /></li>
            <li><img src="images/7.png" /></li>         
        </ul>
    </div>

However, upon clicking an icon I would like for this section to be reloaded as a snippet of javascript is updated.

The code for the icon is:

<a href="#"><img src="images/2.png" id="icon#2"></a> | 
<a href="#"><img src="images/3.png" id="icon#3"></a> | 
<a href="#"><img src="images/4.png" id="icon#4"></a> | 

The JS snippet that is updated is:

var win_width = $(window).width();
var num_of_images = 2; // This should be changed to 3, when 3 is clicked, and 4 when 4 is clicked, etc.

So it should reload the ‘viewport’ div on the page only…not the entire page.

Thoughts?

  • 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-16T22:15:03+00:00Added an answer on May 16, 2026 at 10:15 pm
        $(function () {
    
            var num_of_images = 2,
                showAndHide;
    
            $("img[id^=icon]").bind("click", function () {
                num_of_images = parseInt(this.id.replace("icon#", ''), 10);
                showAndHide(num_of_images);
            });
    
            (showAndHide = function (n) {
                $("ul.overview").hide() // hide this while we "do work"
                   .children() // get children
                      .show() // show all children
                      .filter(":nth-child(" + n + ") ~ li") // get the next siblings of the nth child
                         .hide() // hide them
                      .end()
                   .end()
                .show(); // show the parent list
            })(num_of_images)
    
        });
    

    This is a “pending” solution. I have not tested this and I would be surprised if it works.

    EDIT: Alright, I tested and fixed a few things and this seems to work.

    Note that I attached a click handler to those img elements. So you don’t need those anchor tags if you don’t want them.

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

Sidebar

Related Questions

I have a C# app that makes a call out to a cold fusion
I have a wcf service that takes in an IRepository IRepository irepo; public SomeService(IRepository
When i open a popup, i want to be able to set few callbacks
I want to execute a external .exe program from within java. The .exe is
At the moment I'm working on a system that caches dynamically created files, nothing
My problem is simple I have my application which was perfectly executing under framework
I have seen this question here, and was wondering if the same method of
I have interesting thing here, I'm using xcode 4 for my project and I
I have a Note class, and I have a Tuner Class. My Tuner class
I watched some videos, demos of Roo and I kind of liked it. However

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.