How to design 'Sliding gallery panels' using jQuery and CSS3?

Usually, I know how to start a project with tutorials or some experience, but this time I'm stuck on what to even call it. Simply defining the concept could help me search for the right resources.

Here's a quick mockup I put together:

I want to create panels stacked on top of each other where clicking the 'next' button will move the panel to the left (or back for previous tiles). Each panel represents a portfolio project, and within each project, you can slide horizontally to explain different parts of the project on each tile.

Each tile will have a full-background image with a text box taking up half the width. The text should be HTML-based rather than part of the image for better responsiveness.

I believe this layout can be achieved using CSS3 and jQuery, but my searches only lead me to off-canvas navigation menus, which is not what I need.

To help me out, please: 1. Provide the name or search term for this concept 2. Share a tutorial or plugin that could guide me 3. Give me code examples if possible

Thank you in advance!

Answer №1

Implementing a simple technique known as the radio hack can achieve the desired result using solely HTML and CSS (CSS3 to ensure smooth transitions). This approach eliminates the need for extensive jQuery libraries, reducing the load on client-side resources.

The process involves utilizing a set of radio inputs to determine the active "tab." By assigning the same NAME attribute to all radio inputs, selecting one automatically deselects others, ensuring only one tab is displayed at a time.

<input type="radio" name="radio-set" id="radio-1" checked="checked"/>
<input type="radio" name="radio-set" id="radio-2"/>
<input type="radio" name="radio-set" id="radio-3"/>
<input type="radio" name="radio-set" id="radio-4"/>

Content can be structured within any tag, with a navigation system facilitated by labels linked to specific inputs via the FOR attribute. Clicking on these labels triggers tab transitions.

<section>
    <article id="article-1">
        <h2>article 1</h2>
        <label for="radio-4"></label>
        <label for="radio-2"></label>
    </article>
    <article id="article-2">
        <h2>article 2</h2>
        <label for="radio-1"></label>
        <label for="radio-3"></label>
    </article>
    <article id="article-3">
        <h2>article 3</h2>
        <label for="radio-2"></label>
        <label for="radio-4"></label>
    </article>
    <article id="article-4">
        <h2>article 4</h2>
        <label for="radio-3"></label>
        <label for="radio-1"></label>
    </article>
</section>

To style navigation elements, hide the radio inputs and position articles accordingly:

input{ display:none; }

article{
    position:absolute;
    width:100vw;
}

/* Additional CSS styling omitted for brevity */

The use of the "~" selector allows for seamless transitions between sections based on the selected input's state. Leveraging this selector requires proper sibling placement in the HTML structure.

By incorporating vendor prefixes for CSS properties like transitions and transforms, compatibility across browsers is ensured. For further guidance and demonstrations, check out detailed tutorials showcasing similar responsive layouts:

A comprehensive guide along with a fully functional demo highlighting vertical layout variations can be accessed here: http://tympanus.net/codrops/2012/06/12/css-only-responsive-layout-with-smooth-transitions/

Remember to verify prefix requirements and refer to reputable web resources for accurate information on CSS implementation:

-webkit-transition: all 1s;
transition: all 1s;

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

displaying a div as a pop-up within an ASP.NET MVC 4 web application

One aspect of my asp.net MVC 4 application involves a partial view structured like so: <form class="qty-add" action="#" method="POST"> <label>Qty:</label> <div class="inp-controller"> <a href="#" c ...

Having trouble centering an icon in a cell within AG Grid?

I am struggling with aligning my checkmarks within the cells of my AG Grid. Currently, they are all left aligned but I need them to be centered. Adjusting the alignment for text is not an issue, but I can't seem to center the material icons. It appear ...

Fill an HTML table with comma-separated values (CSV) information

After conducting some research on the internet, I attempted to modify a jQuery script in order to populate an HTML table with data from a CSV file. However, I encountered an issue as the table remained empty. Below, you can find the code that I used. Any a ...

The presence of whitespace is causing disruptions in the text alignment within div elements

I've noticed some unwanted white space on my website when viewing it in Chrome and Internet Explorer. It's interrupting the flow of text and I can't figure out where it's coming from. Can someone help me locate and remove this pesky wh ...

Displaying altered textContent

I am working with an SVG stored as a string and making some adjustments to it. The final result is being displayed as text within targetDiv. <html lang="en"> <head> <title>Output Modified</title> </head> <body> ...

Expression fragment in Thymeleaf

In splitting my templates into head/main/footer parts using thymeleaf, I have found a method to include stylesheets and javascript on certain pages while excluding them from others. This is achieved through the use of fragment expressions outlined here. M ...

Please insert a border shade on my navigation bar

I have been attempting to add a special effect to my menu. Specifically, I have been trying to include a 3px border at the top of each "li" element in my menu that only appears when hovered over. Unfortunately, my attempts using :after pseudo-selector hav ...

Showing identification on the drop-down list

Within my dropdown menu setup, I am aiming to achieve a specific functionality. When the user clicks on sub menu, I want the title of sub menu to display in the Menu space as illustrated below. What steps can be taken to accomplish this? UPDATE: After fu ...

Guide: Generating a DIV Element with DOM Instead of Using jQuery

Generate dynamic and user-defined positioning requires input parameters: offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth ...

What is the best way to add or delete data when specific radio buttons are chosen?

Hey there, I'm facing an issue where the data is being appended regardless of which radio button is selected. Can someone help me with a solution on how to properly add and remove data based on the selected radio button? $( document ).ready(functio ...

Modify the sticky menu color upon scrolling

While working on a client's website, I've stumbled upon an issue that has left me scratching my head. I'm looking to modify the color of the sticky menu once it's scrolled. Can anyone assist me in creating a custom CSS code to implemen ...

Difficulty arises with a simple click, resulting in two separate form submissions

I am aiming for the user to complete one form and utilize JavaScript to post the form into two different places. To achieve this, I have created a JSFiddle found here. On my website, there is a single form with an input[type='submit'] button. U ...

Changing form position dynamically based on selection can be achieved by following these steps

I am creating a website that functions as a compact Content Management System, enabling users to effortlessly modify most of the site's content. Within my rails application, I have established two models: Category and Subcategory. A Category has mult ...

The jQuery script version 3.5.1 encountered an error at line 4055 where DataTables was unable to access the property "aDataSort" due to it

Hey there, I'm currently facing a small challenge while trying to incorporate Datatables within a bootstrap modal to display the results of a SQL Server query. The main requirement is to provide the option to export the data as an Excel file or in oth ...

The menu on the webpage in smartphone mode is infiltrating other divs on the page

Encountering an issue with the TwitterBootstrap CSS menu on this page when viewed on a smartphone: The div containing the menu does not resize its height, causing it to invade the content below when the "Menu" is clicked. I've been unable to find a ...

Bringing the Jquery cursor into focus following the addition of an emoji

Looking to add emojis in a contenteditable div but facing an issue with the cursor placement. Here is a DEMO created on codepen.io. The demo includes a tree emoji example where clicking on the emoji adds it to the #text contenteditable div. However, after ...

Modifying the information depending on the option chosen from the dropdown menu using angularJS

I have a dropdown menu where I can choose between two options, and when selected, the corresponding data is displayed. However, I would like to display the data that is inside a div tag instead. Check out this Fiddle Demo HTML: <div ng-controller="Ct ...

Utilizing AJAX in Wordpress to Dynamically Update HREF Links

My website now has AJAX functionality, and you can see a live example at www.mathewhood.com. I am interested in changing the URL format when clicked from To something like , without the /sitefiles/ for security reasons. Below is my code. If anyone is ex ...

having difficulty deleting text from autocomplete field

I am currently working on implementing autocomplete functionality on my website. While the autocomplete feature is functioning correctly, I am facing an issue with clearing the search field after selecting an item from the list. function clearThis(targe ...

Is there a way to stop TD from going to the next line?

I am using Javascript to dynamically generate a table and I want it to extend beyond the boundaries of the page. When I manually create the table, it works fine and extends off the page, but once I put it into a loop, the <td> elements wrap onto a se ...