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:
- var rolloverHandler = function() { ... };
- jQuery('#navigation a.item').each(function() {
- var item = jQuery(this);
- if ( user agent is an iPad ) {
- item.click(rolloverHandler);
- item.dblclick(function() {
- // Do normal navigation on double-tap.
- window.location.href = item.attr('href');
- });
- }
- else {
- item.mouseover(rolloverHandler);
- }
- });