CSS menu that is activated on click

I'm currently working on creating a responsive menu, but unfortunately, I'm facing issues with getting the menu to open. Any assistance or advice would be greatly appreciated.

<navi>    
         <div class="gizli"><i class="fa fa-bars" style="color:#FFFFFF; border:1px solid #FFFFFF;height:60px;padding :20px;"></i> 
          <div class="clear"></div>
            <ul>
                <li><a href="index.html">Main Menu<br /> <small>Main Menu</small></a></li>
                <li><a href="about.html">About Us<br /> <small>Learn More</small></a></li>
                <li><a href="projects.html">Projects<br /> <small>View Our Projects</small></a></li>
                <li><a href="services.html">Our Services<br /> <small>Discover What We Offer</small></a></li>
                <li><a href="products.html">Products<br /> <small>Explore Our Products</small></a></li>
                <li><a href="techinfo.html">Technical Info<br /> <small>Get Technical Insights</small></a></li>
                <li><a href="quote.html">Quote<br /> <small>Request a Quote</small></a></li>
                <li><a href="contact.html">Contact<br /> <small>Reach Out to Us</small></a></li>
            </ul>
        </div>
    </navi>

Javascript code snippet:

 $(document).ready(function() {
$(".gizli").click(function(){
    $(this).next("ul").slideToggle();
});

}

CSS Code excerpt:

/* Design Shack Responsive Menu */

/* Navigation Menu */
* {
    -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
            box-sizing: border-box;
}
navi {  right:15%;  margin: 0 auto; overflow: hidden;}

navi ul {list-style:none;overflow:hidden;padding-right:4%;padding-left:4%;}

navi .clear{clear:both;}
navi li a {
    background: #444;
    border-right: 1px solid #fff;
    color: #fff;
    display: block;
    float: left;
    font: 400 13px/1.4 'Cutive', Helvetica, Verdana, Arial, sans-serif;
    padding: 25px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    width: 12.5%;
    height:80px;

    /* TRANSITIONS */
    -webkit-transition: background 0.5s ease;
       -moz-transition: background 0.5s ease;
         -o-transition: background 0.5s ease;
        -ms-transition: background 0.5s ease;
            transition: background 0.5s ease;
}

/* HOVER Effect */
navi li a:hover {
    background: #222;
}

/* SMALL Details */
navi small {
    font: 100 11px/1 Helvetica, Verdana, Arial, sans-serif;
    text-transform: none;
    color: #aaa;
}

/* Blue Menu Styling */
navi .blue {
    margin-top: 50px;
}

.blue li a {
    background: #75b1de;
}
/* Hidden Menu Toggle Button Styling */
navi .gizli{
    height:0;

}
navi .gizli a{  
    padding-left:0;
}


.blue small {
    color: white;
}

.blue li a:hover {
    background: #444;
}

/* RED MENU Styling */

navi .red {
    margin-top: 50px;
}

.red li a {
    background: #5C0002;
}

.red small {
    color: white;
}

.red li a:hover {
    background: #a60306;
}

/* MEDIA QUERIES for Responsiveness */
@media only screen and (max-width : 1220px),
only screen and (max-device-width : 1220px){
    navi li a {
        font: 400 10px/1.4 'Cutive', Helvetica, Verdana, Arial, sans-serif;
    }

    navi small {
        font: 100 10px/1 Helvetica, Verdana, Arial, sans-serif;
    }

}

... <!-- The CSS media queries continue, ensuring responsiveness up to the specified breakpoints -->

I seem to be experiencing some difficulties implementing my design according to the CSS file provided, especially around the 580px mark. Your help in resolving these issues would be highly appreciated. Thank you!

Answer №2

Give this a shot to trigger the sliding effect on the ul list (use find instead of next method)

$(this).find("ul").slideToggle();

This method is effective when there is only one ul element within the div block. Your current code may not work as expected due to two additional components following the div with class gizli before reaching the ul.

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

Issue with React Testing Library: Attempting to access the 'contents' property of an undefined value in Redux

Hello, I'm new to writing test cases using React Testing Library. Below is the code of my component: import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; ...

Incorporating HTML into a WordPress Plugin

I am currently working on my very first WordPress plugin. The main purpose of this plugin is to display a message on the plugin page whenever a user saves or edits pages. However, I'm experiencing some issues with printing out these messages. Here&ap ...

Unable to define the coordinates of one object in relation to another in three.js

My understanding of how positions work may be off, as they are not behaving the way I anticipated. When I create two Object3Ds, I would expect to be able to set the position property of the second one as a reference to the first so that it follows it, but ...

`Connected circles forming a series in d3`

I am currently working on developing an application where the circles are positioned such that they touch each other's edges. One of the challenges I am facing is with the calculation for the cx function. .attr("cx", function(d, i) { return (i * 5 ...

The requested resource at http://127.0.0.1:8000/storage/profiles/ could not be located (Error 404: Not

I have successfully implemented a feature on my website that allows users to upload their avatar picture using Vue.js and Laravel as the backend. The image is stored in the storage directory, and I can display it on the user's profile page using Vue.j ...

Tips for effectively using the JQuery animate function

Displayed below is my implementation of the jQuery animate method abstraction that works well. However, a challenge arises when trying to replace the hard-coded DOM element class in the function ani(){} with the 'this' keyword for versatility acr ...

Problem with displaying images and videos in a lightbox gallery

Currently, I am encountering an issue with the lightbox feature on my website. When trying to play a video, there seems to be a layer (div tag) blocking it, preventing me from playing or stopping the video. This problem occurs when clicking on an image fir ...

Errors have popped up unexpectedly in every test file after importing the store into a particular file

Using Jest and Enzyme to test a React application has been successful, but encountering failures when importing redux store in a utility file. The majority of tests fail with the following error: FAIL app/containers/Login/LoginContainer.test.js ● Te ...

Trouble with CSS Vertical Alignment: Solutions to Fix it

Link to a JSFiddle for reference: http://jsfiddle.net/STmwz/4/ Initially, there is only the top div displayed. Upon clicking the edit button, the JavaScript code replaces the top div with the bottom div. However, during this transition, there is a slight ...

Learn how to toggle the visibility of three div elements arranged horizontally

$(document).ready(function () { $("#toggle").click(function () { if ($(this).data('name') == 'show') { $("#sidebar").animate({ width: '10%' }).hide() $("#map").an ...

Is there a way for me to determine the value or array that has been passed in the form?

I am facing a challenge and need help solving it. I have a project that involves interacting with a database, where I created a CRUD HTML table for data manipulation. There are 15 tables in the relative database, and I need to insert, delete, and edit reco ...

Problem with fixed element on mobile due to viewport width

I am experiencing an issue with the fixed element's width. Here is a code snippet for reference: https://codepen.io/highfield/pen/PKpXGG <body> <nav class="navbar"> <div style="position:absolute; left:20px; top:12px"> & ...

Having difficulty formulating a MongoDB query that includes a subquery

I have a dataset structured as follows: { "id": "02741544", "items": [{ "item": "A" }] }, { "id": "02472691", "items": [{ "item": "A" }, { "item": "B" }, { "item": "C" }] }, { "id": "01316523", "items": [{ "item" ...

Is there a way to make a single background image the frame for each individual post on a tumblr theme?

I've set my sights on a more challenging goal for my custom Tumblr themes - I want to have a background image for each post, similar to how other themes display posts within boxes. Is there a way to make these boxes into images? I've tried tinke ...

After a link is clicked in the Rails web app, the style undergoes a subtle transformation

Encountering an issue with my HTML/CSS that seems to be connected to Rails and its asset pipeline. Initially, the styling of my web app is perfect on the first page load (and hard refreshes). However, as soon as I click on a link, navigate away from the pa ...

Use the 'url' parameter to pass into the ajax function when using jQuery for online requests

I am working with an ajax code that retrieves data from an XML file locally. <script> function myFunction() { $("#dvContent").append("<ul></ul>"); $.ajax({ type: "GET", url: "test.xml", ...

Tips for making a customized drop-down menu using JSON format in AngularJS

This is a unique json dataset I created {0: {'Married Status': {'M', '', 'S'}}, 1: {'COMNCTN_IND': {'', 'OFC', 'RES', 'PGR'}}} I attempted the following: Code: ...

What is the best approach to breaking down attributes upon import according to the theme?

Hey there! Here's the thing - I have this file called <code>colors.ts:</p> export const black = '#0C0C0C'; export const blue = '#22618E'; Whenever I need to use a color, I import it like so: import {black} from 'S ...

I am encountering the error 'user.matchPassword is not a function' while making a call to my API using bcryptjs in my Node.js and Express application. Can someone help me understand why

const checkUserAuth = asyncHandler( async (req,res)=>{ const { email , password } = req.body; const foundUser = User.findOne({email}); if(foundUser && (await foundUser.verifyPassword(password))){ generate ...

Why is it that the bootstrap text color class isn't applying for my project?

After some experience with bootstrap, I have encountered an issue with the text-white class. Despite trying to change the text color using this class, it doesn't seem to work. Below is the code that I've been working on. Can anyone spot what migh ...