From 6525931fb9194e90a4430660086a5e981567fb7f Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Fri, 17 Jan 2020 10:33:11 +0000 Subject: =?UTF-8?q?Don=E2=80=99t=20highlight=20duplicate=20pins=20on=20mob?= =?UTF-8?q?ile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The presence of the ‘mouseenter’ handler meant two taps were required to expand the report preview. --- web/js/duplicates.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'web/js/duplicates.js') diff --git a/web/js/duplicates.js b/web/js/duplicates.js index 22f800694..4f1574c0f 100644 --- a/web/js/duplicates.js +++ b/web/js/duplicates.js @@ -93,15 +93,21 @@ $('.js-hide-if-invalid-category_extras').slideUp(); } - // Highlight map pin when hovering associated list item. - var timeout; - $reports.on('mouseenter', function(){ - var id = parseInt( $(this).data('reportId'), 10 ); - clearTimeout( timeout ); - fixmystreet.maps.markers_highlight( id ); - }).on('mouseleave', function(){ - timeout = setTimeout( fixmystreet.maps.markers_highlight, 50 ); - }); + if (!fixmystreet.map.events.extensions.buttonclick.isDeviceTouchCapable) { + // Highlight map pin when hovering associated list item. + // (not on touchscreens though because a) the 'mouseenter' handler means + // two taps are required on the 'read more' button - one to highlight + // the list item and another to activate the button- and b) the pins + // might be scrolled off the top of the screen anyway e.g. on phones) + var timeout; + $reports.on('mouseenter', function(){ + var id = parseInt( $(this).data('reportId'), 10 ); + clearTimeout( timeout ); + fixmystreet.maps.markers_highlight( id ); + }).on('mouseleave', function(){ + timeout = setTimeout( fixmystreet.maps.markers_highlight, 50 ); + }); + } // Add a "select this report" button, when on the report inspect form. if ( $('#report_inspect_form').length ) { -- cgit v1.2.3