Picture navigation tool

Looking for a way to create a side navigating menu bar using HTML and CSS? The challenge is wanting the menu items to only appear after clicking on a small image positioned at the top left corner of the page, which happens to be my website logo.

Does anyone know how to make it so that when the top left logo is clicked, the menu bar slides down below it with all the menu items inside?

Answer №1

If you're open to using a jQuery plugin, check out sidr - it's incredibly easy to implement.

<a id="simple-menu" href="#sidr">Toggle menu</a>
<div id="sidr">
  <div class="logo">
      <img src="https://placehold.it/300x100" alt="">          
  </div>
  <ul>
    <li><a href="#">List 1</a></li>
    <li class="active"><a href="#">List 2</a></li>
    <li><a href="#">List 3</a></li>
  </ul>
</div>

$(document).ready(function() {
  $('#simple-menu').sidr();
});

Check out the Live Demo here

Answer №2

<a id="custom-link" href="#menu"><img src="picture.jpg" alt="photo"
 style="border:none;" /></a>

 <div id="menu">
 <div class="header">
  <img src="https://example.com/placeholder" alt="">
</div>
<ul>
<li><a href="#">Item 1</a></li>
<li class="selected"><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>

Additionally, here is the jquery code:

$(document).ready(function() {
  $('#custom-link').menu();
});

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

Discovering the Sum of K with Node JS Value Mapping

Imagine you have a list of numbers like this: const arr = [{ key1: 10 }, { key2: 5 }, { key3: 7 }, { key4: 17 }];, and also a number k which is represented by const k = 17;. Your task is to determine if any two numbers from the list can be added up to equa ...

Switching the horizontal tab design from Bootstrap 3 to Bootstrap 4

I'm currently working on adapting a code snippet from bootsnip that creates horizontal Bootstrap tabs with material-style design. I've encountered some challenges in converting it to Bootstrap 4, specifically in updating the CSS to use .nav-item ...

Submitting various ajax data from dynamically created fields

Is there a way to send multiple data from dynamically generated fields in ajax? I am facing an issue with using a for loop since I can't foresee the number of fields in advance. $.ajax({ type: 'GET', data:{ ...

Exploring the equality of objects in NodeJS

Currently, we are in the process of creating tests for a program. Our goal is to develop a functional test that validates whether the output of the program aligns with certain expectations. The data returned from the program consists of a complex JavaScrip ...

Example of using the CSS property white-space with break-spaces

I've been searching for an example of using css white-space: break-spaces for hours with no luck. Most tutorials only cover examples for normal, nowrap, pre, pre-wrap, pre-line. When it comes to break-spaces, the information available is limited to qu ...

Location of the html header navigation bar and main content area

Seeking assistance with HTML, CSS, and Bootstrap. I'm trying to create a template for my website that includes a top header, a side navigation bar, and a main section. However, I am struggling to position these elements correctly. The side navbar is a ...

Both the maxlenght and ng-maxlength directives appear to be ineffective in AngularJS

In my HTML file, I have the following input: <input name="password" id="newPasswordConfirmation" ng-model="newPasswordConfirmation" type="number" inputmode="numeric" placeholder="" required ...

Conceal the div once it reaches the top of the webpage

Is there a way to hide an "h1" element when its parent div reaches the top of the page and then show it again when it moves down using both JQuery and CSS? I attempted to utilize a scroll listener in JQuery to toggle a class, but this resulted in the "h1" ...

Is it possible to align multiple lines of text in a vertical manner, such as menu elements?

I am currently attempting to align the text vertically within a UL. The issue is that some list items contain multiple lines of text, preventing me from using line-height. For reference: The fiddle: http://jsfiddle.net/jaAYT/ Desired result: HTML struc ...

What could be causing the `project.addSourceFilesAtPaths("../../tsconfig.json");` function to not retrieve the expected source files?

Using ts-morph to locate all the source files is crucial. The code snippet below demonstrates this: The key code for this operation is as follows: let tsmorph = require('ts-morph') const project = new tsmorph.Project(); project.addSourceFiles ...

What is the best approach for fetching a refined selection of items from an array of IDs using GraphQL?

If I have a list of products stored in my database, it might look something like this items: [ { id: '001', name: 'Product 01', description: 'Awesome product' price: 50.00 }, { ...

The RxJS scan operator has the ability to retrieve only the most recently pushed partial data

I am facing a challenge with managing a BehaviorSubject. My goal is to update it by passing a Partial<Type> and I have implemented the following code structure. The use of scan helps in merging new and old data seamlessly. personUpdates$ = new Behavi ...

What is the process for retrieving the address of the connected wallet using web3modal?

I've been working on an application using next.js and web3. In order to link the user's wallet to the front-end, I opted for web3modal with the following code: const Home: NextPage = () => { const [signer, setSigner] = useState<JsonRpcSig ...

Tips for effectively incorporating additional directives into a directive as it is being defined

I'm encountering a significant issue with dynamic directives in angularjs. My goal is to include new directives to a directive while defining it through an object: compile: function () { return { pre: function (scope, iElement, iAttrs) { ...

The challenge of handling multiple save conflicts in asynchronous Mongoose operations

My Node/Mongoose/Socket.io setup is presenting a challenging logic issue. Imagine a scenario where the Server model is frequently accessed and updated simultaneously in my application. db.Server.findOne({_id: reference.server}).exec(function(error, se ...

There is no Extend method in Backbone.js

I'm new to using Backbone.js and I'm encountering some difficulties with getting it to load properly. It's throwing an error that says: Uncaught TypeError: Object function (a,b){var c,d=a||{};this.cid=f.uniqueId("c");this.attributes={}; ...

Slider buttons are not appearing in Time Picker

I recently added a Time Picker to my project, but I'm experiencing an issue where the slider buttons for selecting time are not showing up. Could you please refer to this image: Checking the console, there don't seem to be any errors present. ...

What is the best way to transmit the server response information from a fetch API to the client?

After receiving a response with the expected results from an API call using fetch API and a json object, I am looking for ways to send these results to the client in order to display them on the interface. The server-side operation was conducted through th ...

The scss function is returning an invalid property value

In my Angular project, I have organized my scss files/folders in the following way: 1) Settings - containing color settings and functions for the project 2) Files and folders defining variables such as fonts, widths, etc. for components and pages 3) Fil ...

An iframe perfectly centered both horizontally and vertically, featuring a 16:9 aspect ratio and utilizing the maximum screen space without any cropping

Specifications: It is mandatory for the iframe to be enclosed within a div container as shown in the code below. The container should have the flexibility to adjust to any valid width and height using the vw and vh viewport units. Check the code provided ...