Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-16-2013, 07:31 PM   PM User | #1
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
Any suggestions on how to handle this?

Hello,

I am trying to update our site so that it works well on mobile devices. We have links with hover states and an onclick event. This creates a problem on mobile devices. When you try to click (touch) on the link you get the hover state, than you must click again to get the click event.

I am worried that I will need to create some code similar to this:
Code:
if(mobile_device)
{
     look for all instances of link code and remove hover state;
{
Code:
<a class="glossaryLink" href="#" onmouseover="onRollOverPULink(event, 'IT');"onmouseout="onRollOutPULink(event);" onclick="showHideGlossary('IT')">
Can anyone help me out here?
m2244 is offline   Reply With Quote
Old 01-17-2013, 12:27 AM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,468
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
it's easy enough:

Code:
if(navigator.userAgent.match(/(mobile|android|ios)/i)){
  [].slice.call(document.querySelectorAll("a[onmouseover]")).map(function(a){
     a.onmousover= a.onmouseout= null;
  });
}
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 01-17-2013, 03:27 PM   PM User | #3
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
Why was this moved? I guess I should have mentioned jQuery Mobile.
m2244 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:23 PM.


Advertisement
Log in to turn off these ads.