On some mobile devices, the links and icons coded in the backend are not appearing as expected

UPDATE:

After suspecting an issue with fontawesome, I decided to switch the icons to plain text:

<a href=\"javascript:void(0)\" onclick=\"expandMenu($(this))\" class=\"show-second-level toggle\"><span>V</span></a><a href=\"javascript:void(0)\" onclick=\"retractMenu($(this))\" class=\"hide-second-level toggle\"><span>^</span></a>

The plain text links are now visible and functional on all devices except for iPad, where they do not respond when clicked.


I have implemented a collapsible menu on my website. Within the unordered list (ul), there are categories displayed with small caret links (fontawesome) that open/close the inner menu. This is how it appears on my iPhone:

Screenshot of menu on my iPhone

View of expanded menu

The red border surrounds the 'a' tag, indicating that clicking within this area will expand the menu. This functionality works as expected on all desktop browsers and my iPhone. However, a client has reported issues on an iPad, MS Surface Pro, and Android phone. Each device presents different problems such as missing arrow links or non-responsive areas.

This is the code responsible for generating these menu items:

<ul>
    <asp:Repeater ID="MenuRepeater" runat="server" OnItemDataBound="MenuRepeater_ItemDataBound">
        <ItemTemplate>
            <li <%# (Container.DataItem as LinkData).Class %>>
                <asp:HyperLink ID="MenuHyperLink" runat="server">

                </asp:HyperLink>

                <%# (Container.DataItem as LinkData).ExpandLinks %>       

                <ul>
                    <asp:Repeater DataSource='<%# DataBinder.Eval(Container.DataItem, "SubLinks") %>' runat="server">
                        <ItemTemplate>
                            <li <%# (Container.DataItem as LinkData).Class %>>
                                <a href='<%# DataBinder.Eval(Container.DataItem, "Link") %>'><%# DataBinder.Eval(Container.DataItem, "Text") %></a>
                            </li>
                        </ItemTemplate>

                    </asp:Repeater>
                </ul>
            </li>
        </ItemTemplate>
    </asp:Repeater>

</ul>

My assumption is that this issue may be related to CSS or javascript, but I am uncertain about what exactly is causing the problem.

Below is the HTML rendered output:

<ul>
    <li class="active">
        <a id="ctl00_MainContentPH_SideBreadcrumb_MenuRepeater_ctl00_MenuHyperLink" href="/Our-Services/">Our Care</a>
       <ul></ul>
   </li>
   <li class="sub-parent">
       <span>Specialty Care and Programs</span>
       <ul></ul>
   </li>
   <li class="category expandable">
       <span>Programs and Clinics</span>
       <a href="javascript:void(0)" onclick="expandMenu($(this))" class="show-second-level toggle"><i class="fa fa-caret-down"></i></a><a href="javascript:void(0)" onclick="retractMenu($(this))" class="hide-second-level toggle"><i class="fa fa-caret-up"></i></a>
       <ul>
           <li class="category-child">
               <a href="/Our-Services/Programs-and-Clinics/Birthmark-Treatment-Program/">Birthmark Treatment Program</a>
           </li>
           <li class="category-child">
               <a href="/Our-Services/Programs-and-Clinics/Cancer-and-Blood-Disorders-Center/">Cancer and Blood Disorders Center</a>
           </li>
           <li class="category-child">
               <a href="/Our-Services/Programs-and-Clinics/Craniofacial-Reconstruction-Program/">Craniofacial Reconstruction Program</a>
           </li>
       </ul>
   </li>
   <li class="category expandable">
       <span>Rehabilitative Services and Therapy</span>
           <a href="javascript:void(0)" onclick="expandMenu($(this))" class="show-second-level toggle"><i class="fa fa-caret-down"></i></a><a href="javascript:void(0)" onclick="retractMenu($(this))" class="hide-second-level toggle"><i class="fa fa-caret-up"></i></a>
           <ul>
               <li class="category-child">
                   <a href="/Our-Services/Rehabilitative-Services-and-Therapy/Occupational-Therapy/">Occupational Therapy</a>
               </li>
               <li class="category-child">
                   <a href="/Our-Services/Rehabilitative-Services-and-Therapy/Physical-Therapy/">Physical Therapy</a>
               </li>
               <li class="category-child">
                   <a href="/Our-Services/Rehabilitative-Services-and-Therapy/Specialty-Therapy-Services/">Specialty Therapy Services</a>
               </li>
           </ul>
       </li>
       <li class="last  ">
           <a id="ctl00_MainContentPH_SideBreadcrumb_MenuRepeater_ctl04_MenuHyperLink" href="/Our-Doctors/Medical-Specialists/">Medical Specialists</a>
           <ul></ul>
       </li>
   </ul>

Answer №1

Here is a potential solution to your problem: Add an anchor tag with the onclick attribute set to "return expandMenu($(this))", and ensure that at the end of the JavaScript function, you include a return true statement.

 tempLD.ExpandLinks =
                    "<a href=\"javascript:void(0)\" onclick=\"return expandMenu($(this))\" class=\"show-second-level toggle\"><i class=\"fa fa-caret-down\"></i></a><a href=\"javascript:void(0)\" onclick=\"return retractMenu($(this))\" class=\"hide-second-level toggle\"><i class=\"fa fa-caret-up\"></i></a>";


function expandMenu(ele)
{

// Your code goes here


return true;

}

function retractMenu(ele)
{

// Your code goes here


return true;

}

Answer №2

It seems like the issue lies within your CSS file where you need to specify the height for your links. It's important to ensure that they are properly expanded for mobile devices.

Here is an example:

/* desktop */
.menu a {
height:40px;
}

/* mobile */
@media only screen and (max-width : 480px) {
.menu a {
height:auto;
max-height:60px;
}
}

If you can provide me with your CSS file, I can make necessary adjustments to my answer.

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

Retrieving information from an API and showcasing the resulting data in a data grid

An issue arose while attempting to retrieve data from an API and passing it to a DataGrid component. Here is an example of the data returned: { data: [{ type: 'PropertyDamage', id: '100', attributes: { ident ...

Creating a simulation of a sun-like vector rotating around a sphere in three.js

Currently, I am attempting to modify this code (which was originally based on an implementation found here). While I have successfully achieved the desired visualization and rendering effects, my goal now is to introduce realistic movement into the animati ...

Having trouble getting the overflow property to behave correctly in Bootstrap's card-columns? Looking for some pointers on how

When setting a transform scale effect on images in cards within the 'card-columns' of Bootstrap, I noticed that the effect is visible during scaling and then adjusts to fit the card size. The use of 'overflow: hidden' does not seem to h ...

Error encountered in Android webview - specifically restricted to sdk version 30 with access denied issue

Currently, I am in the process of upgrading my app from sdk 28 to sdk 29 so that I can create new versions in November as required. However, sdk 30 is already available, so I attempted this upgrade. While the app functions well overall with sdk 30, I encou ...

How can I effectively update my Vue.js component for optimal performance?

I have a search page with a text box and search button. I implemented a facet using Vue.js. Initially, everything works fine when I search for something. However, after typing a new text and searching again, the facet does not update with the new values. ...

Effective techniques for unit testing in Vue.js

Here's a question that's been on my mind: when it comes to unit testing in Vue.js, there are several different packages available. Vue Test Utils Vue Jest Vue Cypress For enterprise projects, which of these options would be considered best ...

Steps to prevent submission of input field until all necessary fields and checkboxes are filled, disabled the submit button

Check out my basic web application on this sandbox link: codesandbox.io/s/eager-kalam-v1lpg I need assistance with how to prevent the submit button from being enabled until all required fields and checkboxes are filled in. I am fairly new to working with ...

Experience a seamless front/back DIV transition with a mouseover effect similar to the ones on USAT

Recently, I was tasked with creating a mouseover transition effect for a div similar to the one used on USAToday's website. The structure of the boxes on the site includes: <div class="asset"> <div class="front">'image and some t ...

What could be causing my image to not completely fill the background?

I'm struggling to get my background image to fit 100% screen width and height. Unfortunately, the image isn't showing up at all. Can anyone tell me what I'm doing wrong? Below is the code I've tried, but for some reason, it's not ...

Is it possible to utilize the Wicket:id for generating CSS?

Can the wicket:id attribute of an element or component be used for CSS styling instead of the "class" attribute? For example: .tooltipster-arrow span, .column-shifter { display: block; width: 0; height: 0; position: absolute; } Let&apos ...

What is the best way to make my script submit two forms consecutively?

On my website, I have two pages, each with a form. When you submit the first form on the first page, you are redirected to the second page with the second form. How can I submit both forms using a single Greasemonkey script? Here is a step-by-step guide: ...

A type guard for generics in TypeScript

I'm dealing with a variable that can be either of type C1[] or C2<C1>[]. How can I create a type guard for this variable? interface C<T>{ key: string; secret: T; } private isC(d: Foo[] | C<Foo>): d is C<Foo>[] { ret ...

Efficiently transmitting WebSockets events/messages to multiple controllers in AngularJS

Incorporating AngularJs, I created a factory to manage a WebSocket connection effectively. Here is the code: .factory('WebSocketConnection', function () { var service = {}; service.callbacks = []; service.connect = func ...

Encountered an issue starting up the Android Virtual Device (AVD) due to data being stored on a USB memory stick

Upon successful setup of a new virtual device using the Android Virtual Device manager, booting encountered an error: 10:28 Emulator: emulator: ERROR: A snapshot operation for 'Nexus_5X_API_28' is pending and timeout has expired. Exiting... 10: ...

What steps are needed to enable a button once a file has been uploaded and the terms and conditions have been agreed to

On my webpage, users need to upload a list of people and agree to terms and conditions before they can click on the pay button. How can I disable the button until they have uploaded the file and checked the terms and conditions checkbox? // Function t ...

Tips for aggregating the values of object arrays in React props

I need help sorting three top-rated posts. Currently, the function displays three post titles along with their ratings, but they are not sorted by best rating. Can anyone assist me with this issue? {posts.slice(0, 3).sort((a, b) => ...

The code to activate a checkbox through jQuery is not functioning as expected

Here is a JavaScript function that I've been working with: const bindSwitches = function() { $(document).on("click", ".lever", function() { var checkbox = $(this).siblings("input[type=checkbox]"); var hiddenFiel ...

Hide a division when either the body or another division is clicked

<div id="container"> <div class='sub1'></div> <div class='sub2'></div> <div class='part1'></div> <div class='part2'></div> </div> When yo ...

The Protractor test scripts are running with lightning speed, outpacing the webpage loading time

Seeking guidance on automating an angular js website with login functionality. Need to click on the sign-in link and enter username and password, but facing issues with script execution speed being faster than page load. Here is my approach for handling th ...

Upon attempting to start the server, the module 'express-stormpath' could not be located

Upon trying to execute node server.js (in a regular terminal without superuser or root permissions), the following error is thrown: alphaunlimitedg@AUNs-PC:~/my-webapp$ node server.js module.js:442 throw err; ^ Error: Cannot find module 'expr ...