jQuery Side Panel with built-in back button support

I'm currently developing a portfolio website and I want to implement a feature where clicking on one of my projects will trigger a side panel to slide in from the right. The panel should cover 100% width and height of the viewport. I also want users to be able to either click a link or use the browser back button to animate the panel back. Do you think this is achievable?

Answer №1

<style>
#side-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: black;
  opacity: 0;
  transition: 1s all;
  -webkit-transition: 1s all; }
  #side-panel:target {
    width: 100%;
    opacity: 1; }

</style>
<div id="side-panel">

    <div class="content">
        <a href="#" class="close">Close</a>
    </div>
</div>

<ul class="projects">
    <li><a href="#side-panel">Project Alpha</a></li>
    <li><a href="#side-panel">Project Beta</a></li>
    <li><a href="#side-panel">Project Gamma</a></li>
</ul>

Does this solution meet your requirements? The side panel is displayed using the :target pseudo-class which activates when the link changes to #side-panel.

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

Best placement for <img> tag in HTML for creating a background image using CSS (excluding CSS3)

I am currently working on a programming project called Broadway through Codeacademy. I have been given the task of adding a background image to the webpage. It seems like an easy task to accomplish. The simplest way to achieve this effect is by using the f ...

Move your cursor over the image to activate the effect, then hover over it again to make the effect disappear

Looking to enhance my images with hover effects. Currently, all the images are in grayscale and I'd like to change that so that when you hover over an image, it reverts to full color and remains that way until hovered over again. I've noticed so ...

Adjusting the transparency of my banner background image using Bootstrap 4

How can I make the background image transparent without affecting other elements like the navigation menu and main text? After researching online, I discovered that overlaying with a white image of the same size could be the solution. However, when attem ...

Can anyone help me with coloring Devanagiri diacritics in ReactJS?

I am currently working on a ReactJS project and I have come across an issue. I would like for the diacritic of a Devanagiri letter to be displayed in a different color than the letter it is attached to. For example: क + ी make की I was wondering ...

Resizable vertical sidebar that is permanently fixed in place

I am currently working on a bootstrap website where I have set up two main divs in the body - the sidebar and content. The content div on the right adjusts its height based on the amount of content within it, while the sidebar div on the left should remain ...

Make a JavaScript request for a page relative to the current page, treating the current page

When accessing the page /document/1, the request $.getJSON('./json', ... is sending a request to /document/json I'm interested in requesting /document/1/json Is there a method available to automatically resolve this path without having to ...

Center text in the v-text-field label

Greetings! I've attempted various methods to center the label in my v-text-field, but unfortunately none of them have been successful. Please see the code snippet below: HTML Code <v-text-field dark class="centered-input" label="your code">< ...

Adding a new row to a table is causing issues with jQuery

var info = [{ "pin": "015-08-0011-000-01", "arp": "015-08-0011-000-01", "tin": "342-432-423-000", "firstname": "John", "middlename": "James", "lastname": "Jones", "suffix": "", "qtr": "1st ...

`The mysterious world of Ajax and jQuery`

Seeking guidance as a beginner! I have a dilemma - if I send an Ajax request that swaps out a section of the DOM with new data upon success, how can I ensure that the jQuery has access to this updated information? ...

Once the PHP page loads, it becomes challenging for me to dynamically change values in JavaScript

Within my code snippet below, I am aiming to modify the initial value using a slider. The slider appears to be functioning correctly; however, it is not updating the values of timeout as indicated beneath the line $('ul.<?php echo $this->session ...

What could be the reason why both the add and remove functions are unable to work simultaneously within a JavaScript function?

Hi there! I recently started diving into JavaScript and encountered a little hiccup. I've been working on a dice game where images change randomly whenever a button is clicked. The images transition from one to another, but I wanted to add a rolling ...

Utilizing Javascript's Mapping Functionality on Arrays

Here is an array that I need help with: var gdpData = {"CA": 1,"US": 2,"BF": 3,"DE": 4}; I am trying to retrieve the value associated with BF using a loop Can anyone provide guidance on how to accomplish this using either JQuery or Javascript? ...

How can I align the title of a cell to the left while centering the remaining content?

I have a dilemma with two table cells placed side by side that stack upon triggering a media query for an HTML newsletter. I wish to align the headlines "Be Ready" and "Stay Organized" to the left when the responsive code activates, but the use of "margin: ...

Implementing a button row and content alignment next to an image using Bootstrap or CSS

Ensure that the product detail page features a row with labels and buttons, positioned to the right of the image within Bootstrap columns. I have utilized Bootstrap 3 for this page layout. However, upon implementation, I encountered an issue whereby the b ...

CSS - setting all child elements to the height of the tallest child element

Is there a way to ensure that both fieldsets have the same height as the tallest one? See the code snippet below or visit this link for reference: http://jsfiddle.net/zpcXQ/2/ <div id="parent"> <form> <fieldset id="left"> ...

What could be causing the malfunction of this *jquery.dataTables.js* demonstration?

Why is this DataTables.js example failing? Despite being a simple example, it encounters an exception when executed. -What could be causing the failure? (see below) (Is there something wrong with the code? -Or, what other factors can I investigate to i ...

Adjusting the decimal points of numbers within a table to create the illusion of a "centered" alignment within the cell

Looking for a table design featuring a column of decimal numbers, each with varying lengths before and after the decimal point, while keeping the decimal points aligned. The width of the column should be flexible, expanding to accommodate long numbers in ...

Updating and submitting data with Ajax using the `h:commandButton` component

Is there a way to update a div and achieve partial submission with the <h:commandButton> element? In the past, I utilized the <p:commandButton> for partial submission by setting the ajax attribute to true and updating the :statusBlock. Howeve ...

Error: The 'replace' property of null cannot be read in select2

In my Node Express app, I am incorporating select2, and encountering an error when supplying an array as the data source with data: dataBase. The issue arises as Uncaught TypeError: Cannot read property 'replace' of null. Although using an ajax ...

Switching a Rails/Ajax form from create to update mode upon submission

While experimenting with a star ratings page, I encountered an issue where the form element remained in "Create" mode instead of updating to an "Update" method after submission. The rating form is ajaxified, but it lacks the functionality to dynamically sw ...