Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8754585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:39:22+00:00 2026-06-13T13:39:22+00:00

I have this code on jsFiddle that is implemented and works just fine on

  • 0

I have this code on jsFiddle that is implemented and works just fine on desktop browsers and works, to a point, on mobile devices. http://jsfiddle.net/heufT/

What my code is doing

If the screen is larger than 960px wide (or thereabouts) a normal horizontal navigation will be displayed, however if the screen is less than 960px wide the navigation becomes apart of a button, which when clicked reveals the same links in a vertical menu instead. When you scroll the page, the header will shrink to a smaller height and if you go back to the top the header goes back to the same height as before. There is also a .load script that will ensure this all happens even when you resize your browser (mainly for use on desktop).

jQuery(document).ready(function($){

// prepend menu icon
$('nav').prepend('<div id="menu-icon"></div>');

/* toggle nav */
$("#menu-icon").on("click", function(){
    $("ul#prim").slideToggle();
    $(this).toggleClass("active");
});

});

// Navigation resize event on scroll
$(document).scroll(function(){

if($(window).width()>959){
      $("ul#prim").addClass("adjTop");
}

if($(window).width()<958){
      $("ul#prim").removeClass("adjTop");
}

if ($(this).scrollTop()>105){
    // animate fixed div to small size:
    $('header').stop().animate({ height: 90 },50, 'linear');
    $('ul#prim.adjTop').stop().animate({ top: '50%', 'margin-top': 18 },50, 'linear');
    $('ul#prim').stop().animate({ top: 62 },50, 'linear');
    $("img.logo").fadeOut();
    $("img.bao_logo").fadeIn(1000);
} else {
    //  animate fixed div to original size
    $('header').stop().animate({ height: 175 },50, 'linear');
    $('ul#prim.adjTop').stop().animate({ top: '50%', 'margin-top': 18 },50, 'linear');  
    $('ul#prim').stop().animate({ top: 105 },50, 'linear');
    $("img.logo").fadeIn(1000);
    $("img.bao_logo").hide();
}

});

$(window).resize(function() {
if($(window).width()>959){
    $("ul#prim").addClass("adjTop");
}

if($(window).width()<958){
      $("ul#prim").removeClass("adjTop");
}

// Showreel
$(window).resize(function(){
    // Resize video to fix aspect ratio when window resizes
    // Only do this if video is currently visible
    if ($('#showreel').height()!=0){
        $('#showreel').height(($('#showreel').width()/16)*9);
    }
});
});

(function($){

// Custom scrollbars for work feature on homepage
$(window).load(function(){
    $(".scroll-pane").mCustomScrollbar({
            horizontalScroll:true,
            mouseWheel: false
    });
});

})(jQuery);​

The problem

The one thing I have been noticing though on iPad and iPhone especially is that the JS will work but then when you pinch/zoom Javascript completely breaks and the navigation button doesn’t work nor does the shrinking/growing of my header.

I have tried disabling pinch/zoom using the meta viewport tag which obviously stops the user from zooming in to the page but even when you at least try to pinch/zoom and it doesn’t do anything, i’ve noticed the JS still breaks and nothing works.

Has anyone got any pointers? Is there any errors in my code that would casue this? Am I missing anything?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:39:23+00:00Added an answer on June 13, 2026 at 1:39 pm

    Ok so after testing for a couple of days I ended up revisiting the meta viewport tag and added a maximum-scale attribute combined with the user scalable attribute and it cured the problem. Not sure if this is the right way to go about things as the user is prevented from pinch/zooming and therefore impacts usability but this is a short term solution none the less.

    My viewport tag now looks like so:

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this javascript code that creates a slider: http://jsfiddle.net/samccone/ZMkkd/ Now, i want to
I have this code http://jsfiddle.net/DanielMontenegro/7pdU4/3/ Now, supose that I want to put that map
I have this pretty simple jquery example: http://jsfiddle.net/clifgray/NTd95/1/ and in that jsfiddle it works
I have this code : http://jsfiddle.net/VAkLn/6/ When i add a table : http://jsfiddle.net/VAkLn/7/ this
I have this script: http://jsfiddle.net/NV2uV/ It works, but I do not like it. Cons:
I have this code: http://jsfiddle.net/cmF4S/3/ <div style=float: left; position: relative;> <input type=text placeholder=Search... style=float:
I have this code : http://jsfiddle.net/Qchmqs/BSKrG/ <div class=step><-- this is darned wrong <div id=step2><a>Darn</a></div>
I have this Greasemonkey script that works fine in the Fiddle. It's designed to
This is my code so far: http://jsfiddle.net/zY3xx/ I have a blank option in all
I have this code: http://jsfiddle.net/J6vzU/1/ I want to dynamically display thumbnail of uploaded file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.