Make sure to keep "display:inline-block" in place while using fadeTo()

As a design student, I am working on creating a family tree website where users can click on individual circles (ancestors) to view their lineage. Everything has been functioning smoothly so far, except for when attempting to display the lineage of specific ancestors. My code includes divs for individual ancestors nested within parent divs representing "generations." While my jquery functions properly, clicking on individual circles causes the subsequent divs to lose their "display:inline-block" property and appear stacked atop one another. Despite spending several hours trying to fix this issue, I have not been successful.

Below is the relevant code snippet:

HTML:

<div class="elevengen">
    <div class="circle" id="louisa"></div>
</div>
<div class="tengen">
    <div class="circle" id="hank"></div>
    <div id="invisible"></div>
    <div id="invisible"></div>
    <div id="invisible"></div>
    <div class="circle" id="helen"></div>
</div>
<div class="ninegen">
    <div class="circle" id="hls1"></div>
    <div id="invisible"></div>
    <div class="circle" id="gransav"></div>
    <div id="invisible"></div>
    <div id="invisible1"></div>
    <div class="circle" id="poppy"></div>
    <div class="circle" id="grandma"></div>
</div>

CSS:

.elevengen{
margin:auto;
width:60px;
height:60px;
margin-top:50px;
}
.tengen{
margin:auto;
width:300px;
height:60px;
display:none;
}

.ninegen{
margin:auto;
width:420px;
height:60px;
display:none;
}
#louisa{
border-width:4px;
border-color: #8951a0;
margin:auto;
margin-top: 50px;
}

/*tengen*/
#hank{
display:inline-block;
border-color:#d14727;
}

/*ninegen*/
#hls1{
display:inline-block;
border-color:#e96238;
display:none;
}
#gransav{
display:inline-block;
border-color:#e96238;
display:none;
}

#poppy{
display:inline-block;
border-color:#6986c4;
display:none;
}

#grandma{
display:inline-block;
border-color:#6986c4;
display:none;
}

JQuery:

$('#louisa').click(function(){
    $('.tengen').fadeTo(1000, 1.00);
});
$('#hank').click(function(){
    $('#hls1, #gransav').fadeTo(1000, 1.00);
});

Thank you in advance for any assistance offered in resolving this issue!

Answer №1

Simply utilize the .animate method

$('#emily').click(function(){
    $('.sophie').animate({opacity: 1}, 1000);
});
$('#jacob').click(function(){
    $('#juliet, #brandon').animate({opacity: 1}, 1000);
});

Answer №2

Appreciate the help, the animated response didn't quite do the trick (not sure why), but I delved into the depths of stack overflow and stumbled upon a solution that did:

$("div").fadeIn().css("display","inline-block");

Seems like removing the display:inline-block in my css was key, and adjusting the css to match what I needed in Jquery did the trick.

Many thanks!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

`Is it necessary to handle textStatus when encountering an HTTP error during an AJAX request?`

When utilizing jQuery and encountering an AJAX request failure attributed to an HTTP error (e.g., 500 Internal Server Error), what exactly is the assigned value of the textStatus parameter within the error handler function? For instance, $.ajax(...).fail( ...

The website code lacks a dynamically generated <div> element

When using jQuery to dynamically add content to a "div" element, the content is visible in the DOM but not in the view page source. For example: <div id="pdf"></div> $("#btn").click(function(){ $("#pdf").html("ffff"); }); How can I ensur ...

Pressing an ASP.NET submit button triggers a jQuery Ajax call for closing purposes

I am currently developing a webpage in asp.net that utilizes JQuery UI dialog. This dialog contains a submit button which, when clicked, closes the dialog. I am looking to incorporate a call to a Webmethod upon submission. If the method returns true, then ...

I'm wondering if anyone has any insights as to why the CSS rule `body{ overflow: auto;}` is not functioning properly for me. Despite my attempts of adding a class to the body tag and

I am facing an issue where adding body tags to my code in Visual Studio code does not yield the desired results. Interestingly, it doesn't seem to be a syntax error in CSS. body{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI&apo ...

I am unsuccessful in transferring the "side-panel content" to the side panel located on the main menu page

I am facing an issue where I want to pass My left and right Panel to the main menu page (dashboard), but it is not working as expected. The problem arises because the first page that needs to be declared is the login page (/ root) in my case. If I pass it ...

Modifying the overflow behavior within a Vuetify dialog

Is there a way to have a floating action button positioned on the top right of a dialog, slightly overflowing so it's offset from the dialog itself? I'm struggling to override the 'overflow-y: hidden' property set by v-dialog. <v-dia ...

Incorporating AJAX functionality into anchor interactions while preserving href links for search engine optimization benefits

Is it possible to create a link/button that triggers an AJAX/jQuery function to load new content, while still providing a link to the same content on a separate page? I am particularly concerned about SEO and how search engine crawlers will index my sitem ...

Ways to remove border when image is not present

I've been attempting to use JavaScript to hide the border, but it doesn't seem to be working. Is it possible to hide the border in HTML using Java? ......................... Check out my page here Here is a snippet of my HTML: <!-- Single P ...

Gain a comprehensive understanding of the JavaScript syntax utilized throughout the code

I stumbled upon this JavaScript code that enables asynchronous file uploads, but there are certain parts of it that I'm struggling to grasp. Any insights or explanations would be greatly appreciated - many thanks in advance. // Utilizing Ajax for Fil ...

Having trouble with compiling SCSS code

While diving into the world of SCSS, I decided to compile my SCSS into CSS using npm. So I entered npm run compile: sass as defined in my package.json as follows: "scripts": { "compile:sass": "node-sass sass/main.scss css/style ...

Currently, I am encountering challenges with the navigation menu on my website. The technologies I am utilizing for this project include Bootstrap 3, JQuery 2.3.1, Jade, ExpressJS

Greetings! I am diving into the world of Jade templating for Node.js and embarking on a journey to create a basic starter application using Express 4, JQuery, Bootstrap 3, and Jade. I encountered an issue while attempting to incorporate the navbar into my ...

What is the importance of setting height: 0 when flex-basis: 0 is already defined in CSS3 flexbox?

I am currently working on creating a content reader with a fixed size and title that remains visible while scrolling. I attempted to achieve this using CSS3 flexbox with the following structure: .flex { display: flex; flex-direction: column; ...

Implement conditional logic in jQuery for optimal code execution

Currently, I am in the process of updating my website: One interesting feature is that when you click on an image to select a project, the requested WordPress project page loads dynamically within the existing page and the URL changes to include a hash li ...

Having issues with media queries functioning incorrectly in VS Code

`@media(min-width:300px)and(max-width:400px){ div{ background-color: pink; } }` While experimenting with responsive design techniques, I attempted to implement this code snippet. However, it did not work as expected in Visual Studio Code. ...

What causes the content area of my <input> element to extend beyond the boundaries of its parent <span> element?

Please Note: I've been working on extracting code from a WordPress environment running the Salient theme. As of now, I haven't been able to simplify the issue to its core form. There is a possibility that I might figure it out myself, but I welco ...

Position the div to align with just one side of the table-cell

I am struggling with making the height of my code dependent on only the left column, while still allowing the right column to be scrollable if it contains more content than the left column. Despite my best efforts, I can't seem to figure out how to a ...

Tailored class designed to handle navigation between preceding and subsequent items

I am in the process of developing a PHP page that includes fields for First Name, Last Name, Address, ZIP, and various others. My goal is to incorporate an 'Add More' button, a 'Previous' button, and a 'Save' button into the p ...

Basic jQuery request for JSON data

In an effort to send user data to a PHP script and display the results in an element, I am utilizing JSON. The process works smoothly until reaching the response stage. Despite receiving the correct results when logging to the console, attempting to append ...

What is the method to store and retrieve data attributes linked to elements such as select options within the React framework?

Despite my efforts, I'm currently unable to retrieve the data attribute from an option using React as it keeps returning null. <select onChange={(e) => this.onIndustryChangeOption(e)} value={this.props.selectedIndustry}> <opti ...

Exploring Data in a Tree View Format on a PHP Website

Looking for advice on displaying categories and corresponding subcategories on the left side of my website (built using Php and Javascript). I would like the tree to be movable, similar to the functionality featured on this link: Any suggestions on how I ...