The iconbar feature in the mobile menu is experiencing functionality issues

I am currently experimenting with the iconbar property of mmenu (here: )

Unfortunately, I am encountering an issue. The menu opens as expected when I run the code. However, upon closing the menu, it first closes completely and then the container slides slightly to the right. It seems like there is some invisible iconbar that is pushing the content to the right. (it should not push anything even if it was visible since I intend to use the menu in front of the application, floating.)

I would greatly appreciate any insights into what might be causing this and how to resolve it.

Here is the current output: http://jsfiddle.net/ozgen92/eqbaf88q/

Desired behavior: (toggle "iconbar" option at the bottom, extensions section)

Below is the code snippet:

<!DOCTYPE html>
<html lang="en">

<head>
<title>Home</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<!-- Bootstrap -->  
<!-- CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"><!--symbols-->
<!-- JS -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<!-- Mmenu -->  
<!-- CSS -->
<link href="Libs/jQuery.mmenu-5.3.4/dist/css/jquery.mmenu.all.css" type="text/css" rel="stylesheet" />
<link href="Libs/jQuery.mmenu-5.3.4/dist/css/extensions/jquery.mmenu.iconbar.css" type="text/css" rel="stylesheet" />
<!-- JS -->
<script src="Libs/jQuery.mmenu-5.3.4/dist/js/jquery.mmenu.min.all.js" type="text/javascript"></script>

<!-- JQuery -->
<script type="text/javascript">
    jQuery(document).ready(function( $ ) {
        $("#menu").mmenu({
    "extensions": [
      "effect-zoom-panels",
      "iconbar",
      "theme-dark"
    ],
    "offCanvas":{
      "zposition": "front"
    },
    "searchfield": {
      "placeholder": "Search",
      "noResults": "No results found.",
      "add": true
    },
    "navbar": {
      "title": "Main Search"
    },
    "navbars": [
      {
        "position": "top"
      }
    ],
    "sectionIndexer": true
  }, {/* configuration */});

        var API = $("#menu").data( "mmenu" );
    API.open();

    });
</script>

</head>

<body>

<div><!--Wrapper-->
<!--MMENU-->
  <div><nav id="menu">
      <ul>
        <li><a href="/"><i class="fa fa-home"></i>Menu1</a>
          <input type="radio" class="Toggle" checked />
        </li>
        <li><a href="/">Menu2</a>
          <input type="radio" class="Toggle" checked />
        </li>
        <li><a href="/">Menu3</a>
          <input type="radio" class="Toggle" checked />
        </li>
      </ul>
  </nav></div>


  <div class="container">
    <h3>Container Example</h3>
    <p>Yes I am a container</p>
  </div>


</div><!--wrapper end-->



</body>
</html>

The intended image outcome can be viewed here: (captured from mmenu, examples section) https://i.sstatic.net/8RuTN.png

Answer №1

The problem:

Due to my lack of understanding of how this plugin functions, it creates a parent div for your container with the class .mm-slideout (the one we are focusing on), having the property transform set as none.

https://i.sstatic.net/9hPAB.png

However, upon clicking to hide the menu, this transform property changes to translate3d(60px, 0, 0);, essentially moving your container by 60px from the left (as previously discussed).

https://i.sstatic.net/MY0CW.png

The solution:

To prevent this effect, in my limited knowledge of configuring this plugin, the easiest way would be to negate this translate using:

.mm-slideout {
    transform: none !important;
}

http://jsfiddle.net/RedBreast/eqbaf88q/5/

The use of !important is necessary as it will serve as an override, giving this instruction a priority.

There might exist a method to prevent this behavior of the class/div through a plugin property, but since I am unaware of it, resorting to this direct approach is the quickest and simplest way, even though in terms of optimization, removing the class would be better.

Hope this information proves useful.

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

Using jQuery to animate a div within a PHP echo statement

<li> <a id="collection" href="collections.php"> <span class="glyphicon glyphicon-th white"> Collections</span> </a> </li> <?php include "pagination.php" ?> <script> $("#collection").clic ...

Utilize React Material UI to dynamically update state with Slider interactions

Currently, I am in the process of developing a multi-step form (survey) using React.js and the Material-UI components library. However, I have encountered an issue with the slider component at one of the steps – it does not seem to update the state as ex ...

Is it possible to have an input field that is read-only without altering the mouse icon

echo '<input type="text" class="form-control" value="' . $server->address . ":" . $server->connection_port . '">'; Can readonly mode be activated for this input without altering its CSS or the mouse icon when hovering over ...

Is there a way to prevent a keydown event from causing interference with input fields in a form?

I have set up event listeners for the left and right arrow keys as shown below: $(document).keydown(function(e) { switch(e.which) { case 39: $("#next").trigger('click'); break; case 37: $("#prev").trigger('click ...

Showing the content of an email's HTML Body

In developing my Python Django website, I'm looking to showcase emails on the front end. These emails have already been processed in the backend and are retrieved via AJAX in JSON format. My main concern is displaying the HTML body of these emails wi ...

Tips for downloading a file using a Django function triggered by JavaScript instead of redirecting to the URL

Managing a page with multiple buttons that trigger various functions, such as sending an SMS (via API), emailing a file, or downloading a PDF. The button actions are powered by Ajax requests through JavaScript instead of using forms. I initially used Java ...

How to selectively display specific columns when outputting JSON to a dynamic HTML table?

I'm looking to output specific JSON data in an HTML table with JavaScript. The headers will remain the same, but the JSON content will vary. Currently, I have a working function that generates the entire table using JavaScript: <body> ...

What could be causing my col-8 to not align perfectly in the center of the grid system?

Recently, I've been delving into tutorials on how to utilize bootstrap4 and have been experimenting with the grid system. However, I've encountered an issue where my layout is not aligned in the center as intended. Here's a snippet of my cod ...

Ways to transform the DropBox chooser button into an image

I'm looking to incorporate an image in place of Dropbox's default chooser button. Despite reviewing their API documentation, I haven't come across any methods to use alternative elements for the Dropbox chooser. Does anyone have a solution f ...

When using Firefox to scale down a div with CSS `moz-transform`, the border details are unfortunately not retained

When viewing the following HTML in Firefox, you may notice that the right and bottom border is missing. However, Chrome and Internet Explorer display it correctly. Is this a bug in Firefox, or is there another method I can use to make it look consistent ...

Executing a function by clicking on an element with the `ng-click` directive within a Bootstrap modal

I'm working on an app that allows users to submit posts for review. When a user clicks the add post button, I have a Bootstrap modal pop up to confirm their choice. Within this modal, there is a "confirm" button that should trigger a function. Strang ...

Exploring the boundaries of HTML data manipulation using JavaScript or jQuery

In my HTML (within a Twig template), there is the following code snippet: <li id="{{folder.id}}" data-jstree='{"icon":"glyphicon glyphicon-tags", "type":"folder"}' ><a href="#">{{folder.name}}</a> I'm attempting to extrac ...

Positioning an image at the bottom left of the page using absolute positioning is simply not effective

Can anyone help me figure out how to make an image stay just above the footer on the bottom left-hand side of the main content? I've tried using floats, margins, and positioning on left nav elements without success. Here's a link to see what I me ...

Error: When trying to access the 'details' property of an undefined element within a foreach loop in Vue.js, a TypeError occurs

While working in a foreach loop, I'm attempting to assign a value using this particular operator. $.each(this.form.details,(key,value)=>{ $.each(this.form.details,(key1,value1)=>{ this.form.details[key].total=76776; }); }); form: ...

Neglecting to include an HTTP header

I am attempting to create an HTTP request with an Authorization header: $.ajax({ type: 'GET', url: "https://subdomain.domain.com/login", beforeSend: function (xhr) { xhr.setRequestHeader ("Auth ...

What is the best way to save an image in Node.js?

While I am extracting data from a website, I encountered the need to solve a captcha in order to access further data. I thought of presenting the captcha to the user, but the site is built using PHP and PHP-GD, complicating the process. The URL provided in ...

The issue that arises is that only the initial button is able to successfully trigger the opening of

My goal is to create a forum where users can reply to posts by clicking on a "Reply" button that triggers a Bootstrap modal. However, I am facing an issue where the modal only opens when clicking on the first button in a row due to it being placed within a ...

Error: Express JS custom module cannot be located in the root directory's modules folder

The file structure of my express js app resembles this I'm attempting to load a modules folder from the root directory. routes/users.js var express = require('express'); var router = express.Router(); var md=require('./modules') ...

Express Node.js Error: Address Information Syntax Issue

While developing my server using TypeScript for my Angular app to connect to, I encountered an issue when trying to run the code snippet below. It seems that Node.js or TS is not yet compatible with certain ES6 features like destructuring with AddressInfo, ...

A beginner's guide to integrating Socket.io with Express.JS using the Express application generator

Currently, I am attempting to utilize Socket.io alongside Express.JS by using the Express application generator. While searching for solutions, I came across some helpful advice on how to achieve this (check out Using socket.io in Express 4 and express-gen ...