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 5843143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:06:48+00:00 2026-05-22T12:06:48+00:00

In my HTML5 mobile app I use some jquery to hide or show some

  • 0

In my HTML5 mobile app I use some jquery to hide or show some custom controls depending if the user is logged on or not:

Basically the code is the following one:
-> one function ‘createCustomControls’ in charge of calling several time another function ‘createCustomControl’ (without the ‘s’).

function createCustomControls(map){
  createCustomControl("about", map);
  if(!authenticated()){createCustomControl("login", map);}
  if(authenticated()){ createCustomControl("menu", map);}
  if(authenticated()) {createCustomControl("list", map);}
}

function createCustomControl(type, map){
  // Create a div to hold the controls
  var controlDiv = document.createElement('DIV');
  controlDiv.style.padding = '2px';
  controlDiv.index = 1;

// Set CSS for the control border
var controlUI = document.createElement('DIV');
controlUI.style.backgroundColor = '#FFF';
controlUI.style.borderStyle = 'solid';
controlUI.style.borderWidth = '1px';
controlUI.style.cursor = 'pointer';
controlUI.style.textAlign = 'center';
controlUI.title = type.capitalize();
controlDiv.appendChild(controlUI);

// Set CSS for the control interior
var controlText = document.createElement('DIV');
controlText.style.fontFamily = 'Arial,sans-serif';
controlText.style.fontSize = '18px';
controlText.style.paddingLeft = '4px';
controlText.style.paddingRight = '4px';
controlText.innerHTML = type.capitalize();
controlUI.appendChild(controlText);

// Add event listener on click
if(type == "list"){
  google.maps.event.addDomListener(controlUI, 'click', function() {
    ....some stuff
  });
}
if((type == "menu") || (type == "login") || (type == "about")){
  google.maps.event.addDomListener(controlUI, 'click', function() {
    $.mobile.changePage("#" + type, "slideup");
  });
}

// Add control to map
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv);
}

This works correctly the first time I call ‘createCustomControls’:
-> ‘login’ and ‘about’ custom controls are created.

When the user is logged in, I call another time the ‘createCustomControls’ function. It pushes the custom controls (menu, list, about) next to the ‘login’ and ‘about’ ones.

I tried several things to clear the TOP_RIGHT position to get rid of the ‘login’ and ‘about’ controls before inserting the ‘menu’, ‘list’ and ‘about’ ones but none worked….

Any ideas ?

  • 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-05-22T12:06:49+00:00Added an answer on May 22, 2026 at 12:06 pm

    map.controls[position] is an MVCArray. Using removeAt() or clear() should accomplish the task.

    http://code.google.com/apis/maps/documentation/javascript/reference.html#MVCArray

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm needing some help with the datepicker use in mobile app. I'm using the
I have mobile app written in HTML5 using PhoneGap. Some parts of the app
I've worked with JqueryMobile to build HTML5 mobile apps. I use a cache manifest
We have an existing web app built with jQuery Mobile. Our goal is to
I have a mobile app I am creating with JQuery Mobile. When a blackberry
I'm working on a mobile website which is NOT a native iPhone app but
I'm writing an HTML5 app with jQTouch for mobile browsers. I'm setting variables using
I have an app built using jQuery (and using various jQuery-UI tools). For some
I am working on a EDIT: mobile web app which displays some sensitive information
Should we not use HTML5 offline Manifest on iphone because of cache size is

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.