Conceal one div while displaying a new one in its original position

Currently, I have two divs positioned side by side. My objective is to hide or remove the left div and replace it with the right one, which will then shift to the left and occupy the original position of the right div.

This switch should be triggered when the user clicks on the about link.

Here's a snippet of the HTML code:

<div class="nav">
    <div class="column c1">
        <a href="#">About</a>
    </div>
</div>

<div id="feed" class="feed" style="margin-top: 54px;">
    <!-- Content for both divs -->
</div>

And here's the corresponding CSS:

.c1 {
    max-width: 24%;
}

.column {
    position: relative;
    float:left;
    padding-right: 1%;
    width: 585px;
}
/* Additional styling included as well */

The ultimate goal is to achieve a one-page style for the website. While CSS solutions are preferred, suggestions involving jQuery are also welcome.

You can view the full code on CodePen.

Thank you in advance!

Answer №1

If you want to hide a specific division on your webpage, consider using the jquery .hide() function. Your CSS looks good as the divisions are floating to the left.

$(document).ready(function){
    //click event for hiding division
    $('.c1').on('click',function(){
        $('#feed').hide()

    })
}

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

What is the best way to limit the number of items displayed in a Bootstrap card?

While using bootstrap cards to display content, I encountered an issue when integrating it with the backend for looping. The items were continuously added to the right side instead of being set in columns of 3 and continuing straight down. It should look ...

Div is overlapped by footer | ASP .NET

On the main page, the footer appears right under the automatically generated menu bar at the top, causing interference with the main div. This issue seems to be isolated to the main page and does not occur on other pages, indicating a problem specific to t ...

"Every time ajax is called, it will always generate

function lks() { var groupname = document.getElementById('groupname').value; $.ajax ({ url: 'verifyGroup.php?groupname='+groupname, type: 'get', ...

Checkbox malfunctioning when iterated with Angular's ng-repeat directive

Hey! I'm currently working on creating checkboxes using the Angular ng-repeat directive. However, I've run into an issue where the checkboxes are not being checked/unchecked when clicked. My code also includes Bootstrap CSS. Here's a snippet ...

Seems like there's an issue with fetching the data: net::ERR_INVALID_URL when

Looking for some assistance with a particular page . While using Google Chrome and inspecting the page (F12), I noticed an error in the console: GET data: net::ERR_INVALID_URL After some investigation, it seems like the issue lies within an external JS f ...

Utilizing a Dual Column Design for Query Loop within custom-template.php on Wordpress

I've recently designed a custom Wordpress template using PHP. The template fetches all the content and is applied to an empty blog post. The Loop Code I used looks like this: <?php $args = array( 'post_type' => array('produc ...

What is the best way to horizontally align a div that has been resized using -webkit-transform?

Is there a way to perfectly center a div both vertically and horizontally while using -webkit-transform for scale transformation? For instance, have a look at this example: http://jsfiddle.net/yL46b7Lo/ <body> <div class="center" style="-webk ...

PHP-generated AngularJs Select Element

I'm facing an issue with my PHP function in my AngularJS application. I have created a function to select a default option, but it's not displaying the desired value. Here is the function code: function qtyList($selectName, $selectQty){ $st ...

Discovering HTML tags on a mobile browser with switmailor

We have created a form and are using the Swiftmailer library to send its data via email. If a user fills out the form from a desktop browser, the data appears correctly without any HTML tags. However, if the user fills out the form from a mobile browser, ...

Updating content with jQuery based on radio button selection

Looking for assistance with a simple jQuery code that will display different content when different radio buttons are clicked. Check out the code here. This is the HTML code: <label class="radio inline"> <input id="up_radio" type="radio" n ...

Tips for creating a sequence pattern in JavaScript or jQuery resembling 12345-1234567-8

I am looking to adjust this code so that a hyphen "-" is automatically inserted after every 5 characters, and then again after every 7 characters. Currently, the code only inserts a hyphen after every 5 characters. <html> <head> <scri ...

What could be causing SimpLESS to throw a syntax error when encountering a forward-slash symbol in the background shorthand?

Can anyone explain why this specific line (line:2) is causing a syntax error on the SimpLESS compiler? When compiling in-browser using CDNs, there are no issues. However, the same code doesn't seem to work correctly on an iPad for some unknown reasons ...

How to add an 'alt' text tag to a background image sprite

I have a button that opens a new browser window, so I've added alternate_text and title tags to notify the user that a NEW window will open when hovered over. <img class="mp3PlayBtn" alt="Mp3 player opens in popup window" title="Mp3 player opens i ...

When the value in a required input field is empty, the border is activated and the color is styled

Can you please explain this to me? Try running this code in Firefox: http://jsfiddle.net/eMa8y/24/ Here is the HTML: <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> </head> ...

Unable to reset iframe style height in IE8 using JavaScript

I am encountering an issue with resetting the height of an iframe using JavaScript. Here is the code snippet I am working with: var urlpxExt = document.getElementById('urlPx'); urlpxExt.style.height = "200px"; While this approach works well in m ...

Launch a dialogue box by clicking on the buttons corresponding to the article ID

I am currently in the process of setting up an admin panel with some quick actions for managing my articles, such as deleting them. When I click on the trash can icon, a dialog box should open and prompt me to confirm the deletion. This dialog box should b ...

Tips for implementing conditional sections in an Angular template HTML file

Creating three different tables as described below: There is a significant amount of repetitive code. The only variation in each table is the studentPermissions[] array, which contains three objects for each student. Therefore, I am simply changing it ...

Tips for making a slide-in animation that doesn't require adjusting the browser size

As I work on an animation where an img object and text slide in from outside the frame of the webpage upon page load, everything seems to be running smoothly. But there's one glaring issue: right at the start of the page load, the webpage resizes for ...

Enhancing user experience: Implementing a dynamic tooltip feature for an image control within a gridview

I have an Image control within a gridview like this: <asp:ImageButton ID="imgbtnInfo" runat="server" ImageUrl="info.jpg" ToolTip="Button info" title="Info" CommandArgument='<%#Eval("ID") %>' CommandName="Info" /> These are the dyna ...

PHP Code for Removing Selected Entries

Is it possible to delete specific records from a table? For example, if I have records in my table like this: Monday | Tuesday | Wednesday IT | IT | IT When I delete "IT" from any day, all instances of "IT" are deleted from all days. However, I ...