Adjust the width of the offcanvas menu to display on the right side of the screen

I am currently working with zurb-foundation 5.3 and, since I am not familiar with scss, I have opted to use the css version of foundation 5.3. Following a basic example for an offcanvas menu from the foundation docs, I noticed that the default width did not suit my needs, so I searched for a solution on StackOverflow to specify a custom width. Everything worked perfectly when the offcanvas content appeared on the left side of the screen.

However, after making some modifications in order for the offcanvas-content to appear on the right side of the screen, the specified width was not applied as expected. Here is the code that is causing this issue:

    **** HTML ****

    <div class="lorem off-canvas-wrap" data-offcanvas>
        <div class="inner-wrap">    

             <!-- on-canvas-content -->
             <p>some on-canvas main content here</p>

             <!-- off-canvas-content -->
             <aside class="lorem right-off-canvas-menu">
                 <div class="inner-canvas-content">
                     <p>some off canvas menu or other contents here</p>
                 </div>
             </aside>

         <a class="exit-off-canvas"></a>

         </div><!-- end inner-wrap -->
     </div><!-- end offcanvas-wrap -->


     **** CSS ****
     .lorem.move-left > .inner-wrap {
     webkit-transform: translate3d( 500px, 0, 0);
     -moz-transform: translate3d( 500px, 0, 0);
     -ms-transform: translate3d( 500px, 0, 0);
     -o-transform: translate3d( 500px, 0, 0);
     transform: translate3d( 500px, 0, 0);
     }

     .lorem.right-off-canvas-menu {
     width: 500px;
     }

Answer №1

After some careful consideration, I came to the realization that when pushing a block to the left of the screen, the margins will actually go negative. The solution in this scenario would look something like the code snippet below:

.lorem.move-left > .inner-wrap {
     webkit-transform: translate3d( -500px, 0, 0);
     -moz-transform: translate3d( -500px, 0, 0);
     -ms-transform: translate3d( -500px, 0, 0);
     -o-transform: translate3d( -500px, 0, 0);
     transform: translate3d( -500px, 0, 0);
 }

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

Toggle the visibility of the left sidebar by hovering the mouse over it

How can I use CSS/JS to create a toggle function for my left sidebar on mouse hover? I want the Google iframe to display across the entire page when the mouse is in the middle, and the sidebar to appear with the Google iframe at a reduced size when the mou ...

Convert a fixed Jquery div to absolute positioning when it reaches the end of the page

I've implemented a Jquery code that adds a fixed class to a div when scrolling down. However, I now want to remove this fixed class when it reaches the bottom of the page and replace it with a new one that includes position:absolute; and margin-bottom ...

Ways to implement the CSS on images with an ID such as img120 within a div that has a class of 'open'

<div class='cluster' id='12' 'style='width:350px;min-height:150px;border:4px solid #339966;'> <div class='image' style='width:150px;height:150px;border:2px solid black;float:left;margin-bottom: ...

Is the component experiencing issues with its style functionality?

I am attempting to add CSS styles to app.component.ts using the :host property, but I am not seeing the desired results. The CSS is being applied, but not correctly. .ts export class AppComponent { title = "Default Title" data = 'This is defaul ...

css - Arranging pictures in a perfect row

On my webpage, I have 5 images and a div. Currently, the images are displaying one under another, but I want them to appear in a straight line while only showing one image at a time within the div. HTML CODE: <html> <head> <title>My Ci ...

What is the method for modifying the button text to read "No Sign Ups!" once the alert box has been dismissed?

Seeking guidance in jQuery as I aim to modify the text of the "Sign Up Now" button post closing the alert box. I'm contemplating creating a function that triggers once the alert box shuts down, but my attempts so far have been fruitless. Any assistanc ...

Replacing CSS using jQuery/JavaScript

Recently, I encountered a challenge with a table that had its border set as 1px solid silver from an external style sheet (a .css file over which I had no control). The CSS code responsible for styling the table was as follows: my_table tbody td { font: ...

What is the best way to create a unique shadow effect for a container in Flutter?

I am facing a challenge with my screen layout that uses GridView.builder with crossAxisCount: 3. In the itemBuilder, I am returning a Container with shadows on the left, right, and bottom, but so far, I have not been able to achieve the desired outcome. H ...

Firefox only loads images and jquery after a refresh of the page

Upon initially accessing my site after clearing the cache (a jsp page from a spring app), I noticed that the images and styles were not being applied. However, upon refreshing the page (ctrl-r), everything loaded perfectly. In Firefox's console outpu ...

Ensuring H1 Header and Regular Text Are Aligned on the Same Line

Is there a way to place a H1 header and regular text side by side on a single line with a line underneath them? Here is what I have attempted so far: This code snippet was my attempt, however, it did not produce the desired result. Can you point out what ...

Targeting multiple browsers in an Angular 11 project with scss: A comprehensive guide

for instance: i'm currently animating the ::placeholder pseudo element when ::focus is active input::placeholder{ color: grey; transition: all 400ms ease; position: absolute; top: 35%; font-size: 15px; } inpu ...

Struggling to Align Responsive Navigation Bar Items?

Learning how to create a responsive website by following a tutorial here Facing an issue: Unable to position elements to the right of the <ul> within the <nav>. Everything seems to fall below or not align properly. Trying to add a login form n ...

When hovering over the child element, the hover effect on the parent element should be disabled

I'm dealing with a situation where I have two nested <div> elements. <div class="parent"> <div class="child"></div> </div> The challenge here is that I want to change the background of the .parent ...

The HasFile method for FileUpload is returning false incorrectly

The issue I am facing is with the ASP control FileUpload, which always returns false for the method FileUpload.HasFile. Even after trying to implement a trigger, the problem persists. Below is the function associated with the button: protected void btnUp ...

Utilizing negative margins in Bootstrap for row positioning

The design of Bootstrap rows includes a margin (left and right) of -15px. This is primarily due to two factors: The .container has a padding (left and right) of 15px The col-* classes include a gutter of 15px. To prevent the empty space caused by the g ...

I am interested in implementing a "slide up" effect for the "slide menu" when it loses focus

When I focus out of the asmenu class, I attempt to trigger a 'slide up' effect. However, if I select two checkboxes from the child elements within the asmenu class, the focusout event is still triggered. Ideally, I would like the 'slide up& ...

What is the correct method for rotating a cell by -90 degrees?

Trying to rotate text at a -90 degree angle in a header column from a cell. Using the code found here: CSS rotate text - complicated The outcome is shown below: When I rotate, the text does not resize and I want all of it to be on the same line (EXAMENES ...

Unexpected issue encountered for identifiers beginning with a numerical digit

Is it possible to select an element from a page with an id that begins with a number? $('#3|assets_main|ast_module|start-iso-date') Upon attempting to do so, the following error occurs: Uncaught Error: Syntax error, unrecognized expression: ...

Aligning a element at the center is not functioning properly when using margin: 0 auto;

I'm having trouble aligning elements to the center when applying margin: 0 auto. You can view the code here: https://jsfiddle.net/helloworld123/vhhx1o7n/ The goal is to align the elements in the center of the page (.entry-wrap should be centered) and ...

Duplicate label issue with 'No files chosen' message on Bootstrap form control

After migrating to webpack for managing our assets (js, scss, ...), everything seemed to be working smoothly. However, we encountered a minor issue where the input label behind the file-selector-button is overflowing with its neighbor, as shown in the exam ...