Move logo and text when menu is clicked

I have been attempting to create a sliding animation on both the logo and header text when clicking on the menu button. The desired effect is for both elements to slide left, with the menu sliding out of the screen and the text sliding in to replace the logo's position. Additionally, a dropdown menu should appear on the screen. You can view a demonstration of this in the following JS Fiddle: https://jsfiddle.net/n9tjvrjt/

Despite my efforts, I have been unsuccessful in getting this animation to work. The code provided in the JS Fiddle includes additional code that I believe is necessary to demonstrate my attempts. I have focused on using transitions, but for some reason they do not seem to be functioning correctly. Below is an excerpt of the relevant code:

@media only screen and (max-width: 670px) {
  html body .wrapper .header-wrapper .header-row .header-cell.header-profile {
    display: none;
  }
  html body .wrapper .header-wrapper .header-row .header-cell.header-profile.active {
    display: table-cell;
    width: 100%;
    padding-left: 20px;
    -moz-transition: 3s;
    -o-transition: 3s;
    -webkit-transition: 3s;
    transition: 3s;
  }
  html body .wrapper .header-wrapper .header-row .header-cell.header-logo.active {
    position: absolute;
    left: -335px;
    -moz-transition: 3s;
    -o-transition: 3s;
    -webkit-transition: 3s;
    transition: 3s;
  }
}

While the code in the fiddle resembles the desired behavior, the animation never actually plays. I am unsure as to why this issue persists and would greatly appreciate any assistance.

Furthermore, please disregard the lengthy class names, as they are a result of compiling a sass file for the sake of illustrating the problem.

It is crucial to resize your screen to under 670 pixels when testing the demo on the fiddle.

Answer №1

To properly implement the transition effect, it is recommended to set it for all elements in this code snippet:

 html body .wrapper .header-wrapper .header-row .header-cell.header-logo.active {
    position: absolute;
    left: -335px;
    -moz-transition: all .3s ease-in;
    -o-transition:all .3s ease-in;
    -webkit-transition:all .3s ease-in;
    transition: all .3s ease-in;
  }

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

The responsive functionality in Bootstrap is failing to work properly when I resize the browser

I am just starting to learn about bootstrap and I'm facing a challenge with converting a static page into a responsive design. The original width of the page is 980px, so I tried creating bootstrap columns based on the design and applied CSS to correc ...

Tips for preventing overlap between two divs when utilizing position: absolute in CSS

In this CodePen link [https://codepen.io/anon/pen/qvQpaY], there is an issue with overlay between the two divs that have a class name of box-container. The black rectangle is being counted as the overall height by box-container because the red rectangle is ...

Avoid placing function declarations within blocks

My JavaScript code (shown below) is quite messy and has a persistent error that I can't seem to fix. The issue lies within the showPosition function, where I have nested a function within another function, which is not a recommended practice. I am rel ...

Why isn't my Enum functioning properly to display the colored background?

Why isn't the Background Color showing up when I pass in the BGColor Prop dynamically in my next.js + Tailwind app? I have tried passing in the prop for my component, but the color is not appearing. <Title title='This is HOME' descripti ...

Vertical stacking of Bootstrap columns rather than horizontal orientation

.card { height: 600px; width: 800px; background-color: darkseagreen; padding: 20px; } .box1 { background-color: floralwhite; } .box2 { background-color: rgb(238, 185, 80); } .box3 { background-color: indianred; } .box4 { background-colo ...

Distinguishing Jquery and Ajax

Could someone kindly provide a comparison of the distinctions between Jquery and Ajax? ...

Using Angular to assign a CSS variable to the before/after pseudo-classes

Having trouble passing a variable with [ngStyle] and reading it on the ::before class, any guidance in the right direction would be much appreciated! CSS: .handle-slider__control { height: 7px; z-index:1; background: $colour-alto; positi ...

bash: The command "nodemon" could not be located

My experience with nodemon has been smooth for the past few months. However, today I encountered an error that I couldn't resolve. Despite uninstalling and reinstalling nodemon, as well as force installing it, I still received the same error message w ...

PHP - contact form is live for just 2 hours daily

Hello, this is my first time here and I could really use some assistance. Please bear with me as English is not my strong suit compared to most people here, but I'll do my best to explain my query. So, I have a PHP script for a contact form on my web ...

How to target labels in CSS that end with a colon (*:)

Can CSS target labels that end with an asterisk and colon combination? Is this achievable? Let me elaborate further as per your request: Apologies if my explanation was not clear. I am working with an HTML label element that may end with an asterisk and ...

Explore the functionality of Control+Click using Capybara, Selenium, and JavaScript

Currently, I am utilizing jQuery's Selectable feature on a table, which necessitates the use of control+click in order to select multiple rows simultaneously. I have set up a customized event handler for the selected event so that a specific link is ...

Individual files dedicated to each controller in Angular.js are a common practice in development

In my project, I am looking to create an Angular module with a main controller, as well as additional controllers that are stored in separate files. Main module: var app = angular.module("main", []); app.controller("mainCtrl", function ($scope) { $scop ...

Vue.js Pagination Issue - Current Page Number Beyond Maximum Page Limit

I'm currently working on incorporating pagination into a table showcasing data for Magic: The Gathering cards. By default, the table displays only 5 items per page, with options to select pages and set the number of results per page at the bottom of ...

I'm having trouble understanding how to use JQuery's .live and .remove methods together

Check out this working jsfiddle, except for the function I'm troubleshooting. I am working on code that appends a table to a form when the value changes in the quantity field. I have two goals: Allow only one extra line at a time. Remove the extra ...

Hold on for the asynchronous operation to complete before redirecting in KoaJS

Currently, I am facing a challenge in spawning a child process to manage some POST data in NodeJS (utilizing the Koa framework). My goal is to wait for the child process to complete before redirecting, but due to the asynchronous nature of the child proce ...

Changes made in React are not reflected in the DOM

import React, { Component } from "react"; import ReactDOM from "react-dom"; import "./index.css"; class App extends Component { constructor(props) { super(props); this.state = { text: "", listItem: [] } this.onChangeInpu ...

Access page using AJAX and CodeIgniter

Recently, I've been working with AJAX and CodeIgniter to develop a login form. I've set up the view controller and module form, but when I click the submit button in the login form, nothing happens. I've checked the console.log() for errors, ...

Shadows appear distorted in Internet Explorer 9

After searching online for how to add shadows to my containers, I came across this code that I applied to my divs: .boxShadow { -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); -ms-filter: " ...

Angular: facing difficulty displaying static html pages on server, although they render correctly when run locally

Within my Angular project, I have stored a few static html files (specifically sampleText.html) in the src/assets/html folder. In one of my components, I am attempting to fetch and display this file. The following code is being used for this purpose. Every ...

Troubleshooting issue with Angular's inability to loop through a multi-dimensional JSON

I recently started experimenting with Angular and decided to create a shopping cart application. I found a pre-made site template that organizes items into categories using the following structure: <div class="row"> <ul> <li>item1</li ...