Problem with iPad

Problem with iPad

Hi guys,

I am working on a website where a popout shows when the mouse is rolled over an anchor element. Obviously roll-over behaviour cannot work on touch-screen devices like an iPad.

My client requires that I implement device-specific logic for tablet devices (or at least the iPad). I need to assign rollover event conditionally:

  1. var rolloverHandler = function() { ... };
  2. jQuery('#navigation a.item').each(function() {
  3.    var item = jQuery(this);
  4.    if ( user agent is an iPad ) {
  5.       item.click(rolloverHandler);
  6.       item.dblclick(function() {
  7.             // Do normal navigation on double-tap.
  8.             window.location.href = item.attr('href');
  9.          });
  10.    }
  11.    else {
  12.       item.mouseover(rolloverHandler);
  13.    }
  14. });