On my website I have Javascript that replaces the standard menu if it's viewed on a phone. If I remove the Javascript, the desktop menu will be shown. The code for the script is shown below and the attached image show the javascript menu show from a phone view:
What I want is the Javascript itself to be executed because then the desktop menu wont be shown, but I want the "Please choose page" and the list / box itself to be hidden like it's never even been there.
Can this be done somehow? Users should only se a white space where instead of the box shown in the image.
jQuery.noConflict()(function($) {
$("<select />").appendTo("nav");
$("<option />", {
"selected": "selected",
"value": "",
"text": "Please choose page"
}).appendTo("nav select");
$("nav a").each(function() {
var el = $(this);
var perfix = '';
switch (el.parents().length) {
case (11):
perfix = '';
break;
case (13):
perfix = '-- ';
break;
default:
perfix = '';
break;
}
$("<option />", {
"value": el.attr("href"),
"text": perfix + el.text()
}).appendTo("nav select");
$("nav select").change(function() {
window.location = $(this).find("option:selected").val();
});
});
});
function bookmarksite(title, url) {
if (window.sidebar)
window.sidebar.addPanel(title, url, "");
else if (window.opera && window.print) {
var elem = document.createElement('a');
elem.setAttribute('href', url);
elem.setAttribute('title', title);
elem.setAttribute('rel', 'sidebar');
elem.click();
} else if (document.all)
window.external.AddFavorite(url, title);
}