• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Menu is supposed to be minimized on mobile site, but it is always shown

New Here ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

My menu on the mobile version of my website is supposed to be hidden unless clicked, but it is always showing and in front of the content below. I have to assume there's something wrong in my css, but I cannot figure it out. How could I fix this? The website it heartlandcpr.com if you want to see the code.

Thanks for anything you can do!

Views

415

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 20, 2017 May 20, 2017

ddheartland  wrote

I'm sorry, I don't know if I understand. Do you know where the issue lies or what could be added to make that hidden when the screen is smaller?

It does not appear that you have any coding that will 'hide' the links at mobile size.

Add the below to your css styles:

@media screen and (max-width: 768px) {

#navlinks {

display: none;

}

}

Then add the below code to all of your pages. Include it directly before the closing </head> tag of the pages.

<script src="http://code.jquery.com/jquery-1.10.2.min.js

...

Votes

Translate

Translate
Community Expert ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

You should probably run your page through the validator to clean up your html errors. http://validator.w3.org/nu

I also see 2 links to the same .css file in that page along with some embedded css in the head. The way it's set up now, the embedded css would overwrite exact selectors from the first link, but then get overwritten by the second link. I'm guessing you don't want that.

I'm also not seeing anything in the css that would control the display of the menu when something is clicked.

href="#navlinks"

...doesn't do anything aside from bring the viewer to an element with id="navlinks". Since there isn't one with that id on your page, nothing happens. You have a #navlinks id in your css, but you aren't currently using it and the css isn't affecting the page because of it.

Did you mean to have that href be empty while being id'd as navlinks or something? Like...

<a href="#" id="navlinks">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2017 May 19, 2017

Copy link to clipboard

Copied

I'm sorry, I don't know if I understand. Do you know where the issue lies or what could be added to make that hidden when the screen is smaller?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 20, 2017 May 20, 2017

Copy link to clipboard

Copied

ddheartland  wrote

I'm sorry, I don't know if I understand. Do you know where the issue lies or what could be added to make that hidden when the screen is smaller?

It does not appear that you have any coding that will 'hide' the links at mobile size.

Add the below to your css styles:

@media screen and (max-width: 768px) {

#navlinks {

display: none;

}

}

Then add the below code to all of your pages. Include it directly before the closing </head> tag of the pages.

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

<script>

$(document).ready(function(){

$('#menulink').click(function(){

$('#navlinks').slideToggle();

});

});

</script>

Then remove 'navlinks' from the anchor tag but leave the #

<h2 id="menulink"><a href="#navlinks">Menu</a></h2>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

Sorry, I've been out of the office since you replied. That initially fixed the issue, but then it messed up my accordions. I fixed my accordions now, but the menu issue replicates and is always shown now. Ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

ddheartland  wrote

Sorry, I've been out of the office since you replied. That initially fixed the issue, but then it messed up my accordions. I fixed my accordions now, but the menu issue replicates and is always shown now. Ideas?

What accordions? I dont see any on your homepage?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

They're on the "Payments&Schedule," "STAT PROGRAM" and "PetProject" page. Once I fixed them, the Menu issue replicated site-wide.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

ddheartland  wrote

They're on the "Payments&Schedule," "STAT PROGRAM" and "PetProject" page. Once I fixed them, the Menu issue replicated site-wide.

How is it messing the accordions up? They seem to work ok for me on the below page. Also you must remove the 'navlinks' wording from the the anchor tag '#navlinks' otherwise the page just keeps jumping down and that's not an effect you want to happen.

Heartland CPR Training, American Heart Association, BLS, ACLS & PALS, Healthcare Providers, Heartsav...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

I'm so sorry, I just realized the computer's history hadn't been cleared and it was pulling a previous file. It is working and you helped so much! Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

LATEST

ddheartland  wrote

I'm so sorry, I just realized the computer's history hadn't been cleared and it was pulling a previous file. It is working and you helped so much! Thanks!

No problem, great. Just remove the 'navlinks' wording from the anchor tag as it will be a better experience for your users.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

I don't mean to be critical but some of your design choices need to be reconsidered.  Many people are sensitive to high frequency flicker.  That seizure inducing animated GIF is overwhelming. I had to close that page.  See related links below.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines