jQuery Slide-Up will emerge from either the bottom left or bottom right

I'm currently troubleshooting the behavior of my slide-up footer menu. It seems to be emerging either from the bottom left corner or the bottom right corner, depending on whether I remove left: 0 or right: 0 from the .footerbar css.

If anyone has any insights or suggestions, they would be greatly appreciated. This issue is really frustrating me. :-(

Here is where I am at with the code...

$('#footerNav').addClass('slide-down');

function openNav() {
  $(document).ready(function() {
    $('#footerNav').toggle(function() {
      if ($('#footerNav').hasClass('slide-up')) {
        $('#footerNav').addClass('slide-down', 1000);
        $('#footerNav').removeClass('slide-up');
      } else {
        $('#footerNav').removeClass('slide-down');
        $('#footerNav').addClass('slide-up', 1000);
      }
    });
  });
}
.footerbar a {
  padding: 8px 8px 8px 10px;
  text-decoration: none;
  font-size: 13px;
  color: #818181;
  display: block;
}

.footerbar a:hover,
.footerbar a:focus {
  color: #046B86;
}

.footerbar {
  position: fixed;
  width: 100%;
  z-index: 10000;
  text-align: center;
  height: 500px;
  font-size: 18px;
  color: #000;
  background: #FFF;
  display: flex;
  justify-content: center;
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
  right: 0;
  left: 0;
  margin-right: auto;
  margin-left: auto;
  bottom: -60px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<a href="#" onClick="openNav()">footer tray</a>
<br>
<br>
<br>

<div id="footerNav" class="footerbar">
  <table width="100%" border="0">
    <tr>
      <td>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
      </td>
      <td>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
      </td>
      <td>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
        <a href="#">Stuff</a>
      </td>
    </tr>
  </table>
</div>

Answer №1

By switching to .slideUp() exclusively, the solution worked perfectly. Sometimes it takes a fresh perspective to solve a problem.

Appreciate the helpful suggestion!

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

"Troubleshooting when Firefox encounters an error with jQuery load

Having some issues with the function below for loading content into a target div. It's working fine on Chrome and Safari, but in Firefox (27.0.1, though likely all versions) it pops up an alert saying "0 error". $("#somediv").on('click', &a ...

Send various pieces of information using Jquery/Ajax

I have encountered a challenge with my script - it currently only sends one value to the requested URL, but I now need it to handle two values. Unfortunately, I haven't been able to figure out how to do this. Each checkbox on the page is paired with ...

Timepicker Bootstrapping

I've been searching for a time picker widget that works well with Bootstrap styling. The jdewit widget has a great style, but unfortunately it comes with a lot of bugs. I'm on a tight deadline for my project and don't have the time to deal w ...

What is the syntax for implementing an if-else statement?

Just starting with algolia and looking for a hit template. Please take a look at the script below for the text/html template needed: <script type="text/html" id="hit-template"> <div class="hit"> <div class="hit-image"> <i ...

Encountering a maximum call stack size error is a common issue when implementing d3.layout.partition in Angular

I recently developed an AngularJS directive to generate a D3 sunburst chart, but I'm encountering issues. I'm receiving a maximum call stack error in Chrome and a too much recursion error in Firefox. After some investigation, I found that the pro ...

Pass along a variable with either "&" or "%" to a PHP file utilizing JavaScript

I have a JavaScript script that is sending 4 variables to a PHP page. The issue arises when one or more of these variables contain special characters like "&" or "%". The script ends up only sending the content before those characters. For example, if ...

What is the best method to choose the initial offspring of the primary brother or sister within a list item?

Is there a way to specifically target the nested li elements in my css selector? Check out the Demo li:first-child { background-color: rgb(236, 236, 236); list-style-type: none; margin-bottom: 3px; padding: 8px; } <ul> <li& ...

Can the issue of mangling be avoided during .NET minification?

Currently, I am utilizing the .NET Bundling and Minification feature to bundle and minify the files for my application. While this method works well, I am interested in exploring alternative solutions due to its complexity. Specifically, I am attempting t ...

Enhance Website Functionality with Dynamic Tables and Spreadsheet Features

Currently, I need to incorporate spreadsheet-like functions into a table on my website. Initially, I explored KendoUI but realized it might not be within my budget constraints. Is there a more affordable alternative available? Key features I require inclu ...

ThreeJS: Is CSG the missing wrapper?

I have been utilizing ThreeCSG.js independently to generate various shapes, but I am encountering errors when attempting to create certain shapes: Maximum call stack exceeded. It appears that the repository is not being updated, so I experimented with the ...

Utilizing CodeIgniter Controller for Handling JSON Requests via AJAX

My challenge lies in sending a form using CodeIgniter via AJAX and attempting to receive the response in JSON format. However, I encounter an issue where I can only view the response when I open my developer tab (although unsure if that's the actual r ...

Ways to restrict users from accessing a file stored on the server?

This might seem like a silly question, and yes, it is quite naive. I currently have two files stored on my server: index.html, file.txt Is there a simple way to prevent users from accessing file.txt directly by entering its URL like this: website.d ...

Is it possible to retrieve an element by its id, save it in a variable, and then add it to an li element?

Just delving into the world of JS and attempting to create a simple to-do list. Even after completing tutorials on CodeAcademy and TreeHouse where I learned about functions, if statements, loops, objects, etc., it seems like none of it really sticks until ...

Attempting to upload an item using ThreeJs

Can someone assist me with loading an object file from my local browser in Threejs ( Rev 71)? I keep encountering an error that says loadModel.html:1 Uncaught SyntaxError: Unexpected token #. Even after trying to load the object file using chrome --allow- ...

Sending an Angular scope variable to JavaScript

I am working with an angular scope variable that is being used in ng-repeat. My goal is to create a chart that starts from a specific date, ends at another date, and includes a marker for the current day. I am utilizing loader.js for drawing the charts in ...

Varieties of types within class structures

I've been delving into the world of implementing generic types in classes, but it seems that my understanding of what can and cannot be done with generics is a bit lacking. Hopefully someone out there can shed some light on this for me! My Objective ...

The Battle: AJAX FormData vs encodeURI

When utilizing jQuery's encodeURI(), the data transmitted through AJAX appears in this format: key1=true & key2=34 & ... In order to send an image via AJAX, I employ the FormData() method, resulting in the AJAX data without an image looking ...

Utilizing a JSON array to determine optimal timing according to user preferences

In my pursuit to find the optimal performance for each user from a JSON dataset. const users = [ { "key": "user1", "label": "Henry" }, { "key": "user2", ...

Is it possible to shift the icon over to the right using CSS?

I'm currently working on a website project with Bootstrap and I'm facing an issue with the desktop icon placement. I've tried using float, but I can't seem to get it right for better visibility. Here's an image of how I want it to ...

Try applying CSS rotate3d to a div that is already rotated

Having trouble with the axis of a rotated div. Currently, the diamond rotates within its sides and I want it to rotate from the top center. Check out this example: http://jsfiddle.net/DtQd8/ HTML <div class="diamond"> <div class="diamondIn ...