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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:29:57+00:00 2026-06-04T02:29:57+00:00

Pretty simple solution I’m sure but can’t for the life of me work it

  • 0

Pretty simple solution I’m sure but can’t for the life of me work it out! Any help much appreciated…

Basically I have four ‘li’s each with its own ‘p’. With jQuery I’d like to create a new ‘div’ with class “overlay” and then move each ‘p’ into the respective ‘div’.

So far I have managed to create the ‘div’ but then end up copying all four ‘p’ tags into all four ‘div’s…

Have put a mock up at http://jsfiddle.net/NhezT/4/

My HTML:

<ul class="cat_ul">
    <li class="cat_li music_production">
        <div class="cat_bxs">
            <a href="#"><img class="cat_img" src="#"></a>
        </div>
        <p class="legend">Music Production</p>
    </li>
    <li class="cat_li web_development">
        <div class="cat_bxs">
            <a href="<#"><img class="cat_img" src="#"></a>
        </div>
        <p class="legend">Web Development</p>
    </li>
    <li class="cat_li online_promotion">
        <div class="cat_bxs">
            <a href="#"><img class="cat_img" src="#"></a>
        </div>
        <p class="legend">Online Promotion</p>
    </li>
    <li class="cat_li tutor_mentor">
        <div class="cat_bxs">
            <a href="#"><img class="cat_img" src="#"></a>
        </div>
        <p class="legend">Tutor And Mentor</p>
    </li>
</ul>​

My CSS:

.cat_ul {
    list-style: none;
    width: 840px;
    margin: 0;
    padding: 0;
}
.cat_li {
    cursor: pointer;
    float: left;
    margin: 0 10px;
}
.cat_bxs {
    position: relative;
    width: 170px;
    height: 170px;
    background: -webkit-gradient(radial, center center, 0, center center, 460, from(rgba(255,255,255,0)), to(rgba(0,0,0,.15)));
    background: -webkit-radial-gradient(circle, rgba(255,255,255,0), rgba(0,0,0,.15));
    background: -moz-radial-gradient(circle, rgba(255,255,255,0), rgba(0,0,0,.15));
    background: -ms-radial-gradient(circle, rgba(255,255,255,0), rgba(0,0,0,.15));
    background: -o-radial-gradient(circle, rgba(255,255,255,0), rgba(0,0,0,.15));
    background-repeat: no-repeat;
}
.cat_bxs a {
    display: block;
}
.cat_bxs a img {
    width: 50%;
    height: 50%;
    margin: 25% 25%;
}
.cat_li .overlay {
    display: table;
    position: absolute;
    width: 150px;
    height: 150px;
    left: 0;
    top: 0;
    padding: 10px;
    background: rgba(0,0,0,.5);
    opacity: 0;
}
.cat_li.music_production .overlay {
    background: rgba(216,182,24,.5);
}
.cat_li.web_development .overlay {
    background: rgba(92,164,64,.5);
}
.cat_li.online_promotion .overlay {
    background: rgba(166,66,66,.5);
}
.cat_li.tutor_mentor .overlay {
    background: rgba(41,140,191,.5);
}
.cat_li .overlay p {
    display: table-cell;
    position: relative;
    vertical-align: middle;
    text-transform: uppercase;
    font-size: 10px;
    text-align: center;
    line-height: 2em;
    width: 100%;
    height: 100%;
    color: #333;
}​

My JavaScript:

// Append Function (Broken)

$(document).ready(function () {
    $('.cat_bxs').append('<div class="overlay"></div>');

    $('.cat_li').each(function(){
        $(this).children('.legend').appendTo('.overlay');

    });
});


//Hover Fade

$(document).ready(function () {   
            $(".cat_bxs").hover(function () {
                $("a", this).animate({
                    "opacity": "0.25"
                }, 600, function () {
                    $(this).next(".overlay").animate({
                        "opacity": "1"
                    }, 500);
                });
            }, function () {
                var self = this;
                var inter = setInterval(function () {
                    if (!$(".overlay", self).is(':animated') && !$(".overlay", self).prev("a").is(':animated')) {
                        clearInterval(inter);
                        $(".overlay", self).animate({
                            "opacity": "0"
                        }, 500, function () {
                            $(this).prev("a").animate({
                                "opacity": "1"
                            }, 600);
                        });
                    }
                }, 100);
            });
});

​
Many thanks in advance…

  • 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-04T02:29:59+00:00Added an answer on June 4, 2026 at 2:29 am

    Try this:

    $('.cat_li').each(function(){
        var $li = $(this);        
        $li.find('.legend').appendTo($li.find('.overlay'));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty sure there is a very simple solution here but I can't seem
The solution to this problem is probably pretty simple, but I need some help.
Pretty simple question, but I can't seem to figure out how to do this,
Im pretty sure this has a simple solution. I am using jCarousellite, and i
My question is pretty simple, but I am having a hard time finding any
simple problem, but perhaps no simple solution, at least I can't think of one
My question seems pretty simple but I haven't found a solution. I need to
This is seems like a pretty simple question, but I'm not sure if there's
New Rails programmer here. There is probably a pretty simple solution to this, but
I think this is a pretty simple solution but I have been trying to

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.