JS Prevent Google Map dragging on mobile devices

<script> jQuery(function(){ if (window.innerWidth <= 500) { map.set('draggable', false); } else { map.set('draggable', true); } }) jQuery(window).resize(function(){ if (window.innerWidth <= 500) { map.set('draggable', false); } else { map.set('draggable', true); } }) </script>
Place functions in Google map code where variable map is declared.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.