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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:53:44+00:00 2026-05-17T01:53:44+00:00

I’m new to jQuery and have been following the tutorial here for a Panel

  • 0

I’m new to jQuery and have been following the tutorial here for a Panel Slide.
http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/all-comments/#comments

So far so good.

Though I require a number of panel slides. The page is going to look very similar to this
woothemes.com/themes/

When you click an image a 100% width panel will expand under the row to reveal further information.

I was just wondering if there’s an alternative to using unique classes for each different image?

Hope that made sense.

Thanks for your help.

J.

  • 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-17T01:53:45+00:00Added an answer on May 17, 2026 at 1:53 am

    Instead of classes, you can make use of the relative positions of the elements in the DOM.

    A simple example is to have images followed directly by panels, and make use of .next() when an image is clicked on to slide open the next sibling element.

    You can put all of the images and contents into one parent div. That way you don’t have to use any classes inside that parent div.

    Here’s a simple slider system that degrades nicely if Javascript is turned off.

    Let’s set up a simple example.

    The HTML:

    <div id="sliderContent">
    
        <div>
            <img src="image1.jpg" />
            <div>Content about image1 here.</div>
        </div>
    
        <div>
            <img src="image2.jpg" />
            <div>Other content about image2 here.
                 <p>You can put as much stuff in these as you want</p>
            </div>
        </div>
    
        <div>
            <img src="image3.jpg" />
            <div>Sample content about image3 her here.</div>
        </div>
    
    </div>
    

    The above content will display in a sensible fashion even if Javascript is turned off.

    It’s nice to have the imgs nested in parent divs, since imgs aren’t block level elements, so the line breaks will be nicer with a parent div containing each image and content div.

    divs take up 100% of the width given. You can add child divs in the content divs, you can style them, you can put hrs inside them, etc.

    Now let’s create our jQuery. It’ll make all the content sliders invisible. It will also make it so that the corresponding slider is toggled if an image is clicked.

    The Script

    $(function() {
    
        $("#sliderContent img").next().hide();
    
        $("#sliderContent img").click(function() {
            $(this).next().slideToggle();
    
        });
    });​
    

    jsFiddle example

    And that’s it. Of course you can spruce things up with added graphics and colors, but the central concept is very simple.

    Here is a simple way to add a close button into each content DIV. It’s not good to include the close buttons in the HTML, since they are meaningless if Javascript is disabled, so we add them dynamically:

    $(function() {
    
         // Hide and add a close button to each content div slider
       $("#sliderContent img").next().hide().append('<input ' + 
                                                    'type="button" value="close"/>');
    
        $("#sliderContent img").click(function() {
            $(this).next().slideToggle();
        });
    
          // use .parent() to make the close buttons work
        $("input").click(function() {
            $(this).parent().slideUp();
        });
    });​
    

    jsFiddle example

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

Sidebar

Related Questions

No related questions found

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.