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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:15:55+00:00 2026-06-13T20:15:55+00:00

I have several divs shaped like boxes with questions inside each box. When a

  • 0

I have several divs shaped like boxes with questions inside each box. When a user wands over a box the short answer is revealed with a link which is SUPPOSED to populate a lightbox with the long answer. I would like to get the respective long answer to populate in the lightbox but can’t seem to figure out . Also I’m looking to allow the user to scroll through all long answers while in the lightbox.

I currently generate all html from a ruby loop of rails partials. A simplified example of my existing work is found in a jsfiddle here

The existing html:

<div id="about">

    <div class="wsBox what">
        <div class="wsQ">
            <h1>What</h1>
        </div>

        <div class="wsD" style="display: block; display:none">
            <p>what we do short description.  <a href="#" class="lightBoxOpen">Continue Reading...</a><span class="wsFD">This is a lenghty description of what we do.</span></p>
        </div>
    </div>

    <div class="wsBox who">
        <div class="wsQ" style="display: block; ">
            <h1>Who</h1>
        </div>

        <div class="wsD">
            <p>who we are short description.  <a href="#" class="lightBoxOpen">Continue Reading...</a><span class="wsFD">This is a lenghty description of who we are.</span></p>
        </div>
    </div>

    <div style="clear:both; display: block; height: 30px; margin-bottom: 25px"></div>

    <div id="lightBoxOverlay" class="initHide" style="display: none; ">
    <div id="lightBox">
        <a href="#" class="lightBoxClose">Close</a>
        <div id="lightBoxContent"></div>
    </div>
</div>


</div>​​​​​

JS:

$(document).ready(function(){
    $('#about .wsBox').hover(
        function(){
            $(this).find('.wsQ').fadeOut();
            $(this).find('.wsD').delay(200).fadeIn();

        },
        function(){
            $(this).find('.wsD').fadeOut();
            $(this).find('.wsQ').delay(200).fadeIn();
        }

    );

    $('a.lightBoxOpen').click(function(e){
        $('#lightBoxOverlay').fadeIn();
        $(this)

    });


    $('a.lightBoxClose').click(function(e){
        $('#lightBoxOverlay').fadeOut();
    });

});

​

CSS:

#about{


}
.wsBox{
    padding: 5px;
    position: relative;
    border: 2px solid #669900;
    width: 200px;
    height: 150px;
    border-radius: 20px;
    float:right;
    margin: 2%;
      border-radius: 5%;
      box-shadow: 0px 3px 8px #aaa, inset 0px 2px 3px #fff;
}

.wsQ{
    color: green;
    text-align: center;
    line-height: 150px;

}
.wsD{
    height:150px;
    display:none;
    position: absolute;
    top: 50%;
    margin-top:-36px;
}
.wsD .wsFD{
    display: none;
}
.who .wsD{
    margin-top:-50px;    
}

#lightBoxOverlay{
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0px;
    left: 0px;
    background: rgba(0,0,0,0.6);

}
#lightBox{
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    background-color: #ffffff;
    padding: 5px;
    border: 2px solid #669900;
    border-radius: 20px;
    margin: 2%;
    border-radius: 5%;
    box-shadow: 0px 3px 8px #aaa, inset 0px 2px 3px #fff;
}
#lightBox a.lightBoxClose{
    float: right;
    font-size: .75em;
    margin-right: 10px;
}

EDIT
​working on something like this but the content is the links and not the boxes!

$('a.lightBoxOpen').click(function(e){
    $('#lightBoxOverlay').fadeIn();
    var content = $(this).html();

        $('#lightBoxContent').html(content);

});

​

  • 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-13T20:15:56+00:00Added an answer on June 13, 2026 at 8:15 pm

    Grap html() of the links parent with:

    var content = $(this).parent().html();
    

    or even better:
    var content = $(this).closest(‘.wsBox’).html();

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

Sidebar

Related Questions

I have several divs like this <div rel=5> Divs content goes here </div> <div
Basically I have several divs, each contains a question. This question could be presented
So I have several DIVs called achievement, and each one contains a span called
I have a page with the several divs like: By default all are display:none,
I basically have several divs each with ids id_1, id_2 id_3 etc. The divs
I have several divs for displaying demo boxes of graphics, and code boxes for
I have several DIVs that I want to place beside each other, but because
I have several divs, which are made automatically by php script. Each div have
I have several forms inside DIVS on my page. I have one form which
I have several DIVs with z-indexes (like: z-index: 999991;). In Safari, this results that

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.