"Enhance your website's user experience with the ability to zoom in and out

One issue I encountered on my website was that when I included an iframe, the map would zoom in and out while scrolling. To try to fix this, I set pointer-events to none. However, this caused all actions on the map to be disabled, making it impossible to navigate properly!

Here is the HTML code for the map:

<div class="map">

    <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d29618050.62001087!2d63.250335576086215!3d25.017620133523653!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x30635ff06b92b791%3A0xd78c4fa1854213a6!2sIndia!5e0!3m2!1sen!2sin!4v1450871870014" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

</div>

And here is the CSS code that caused the problem:

.map iframe {pointer-events: none;}

Answer №1

A clever suggestion is to disguise it with a mask:

<div class="location">
    <iframe src="https://www.google.com/maps/embed?xxx"></iframe>
    <div class="disguise"></div>
</div>

Here's the corresponding CSS:

.location .disguise {
    width: 100%;
    height: 100%;
}

Your map will now be inaccessible.


If you prefer left/right navigation without zoom, check out this stackoverflow response for guidance.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

numerous inquiries regarding my CSS header navigation bars

As someone who is new to CSS, I find myself struggling to grasp the correct approach. Online examples vary and leave me confused. Specifically, I have questions about my markup but overall, am I doing things correctly? I feel like my CSS code is bloated. ...

Updating the Position of an Element in ElectronJS (e.g. Button, Label, etc)

Is there a way to change the positioning of a button in a window using JavaScript and Electron? I am trying to create new input boxes next to existing ones, but they always appear below the last one created. Is it possible to specify x and y coordinates fo ...

What is the best way to incorporate next and previous buttons into my slideshow using jQuery?

Looking to enhance my slideshow by incorporating the ability to pause, go to the next or previous image, along with the automatic transitioning feature currently in place. I'm a bit unsure on how to implement these event handlers efficiently within my ...

Achieve vertical alignment and responsiveness of elements in primefaces using css techniques

In order to vertically align 2 elements inside an outputpanel, I initially used a margin-top of 3em. However, this method proved to be non-responsive, as shown in the following images: https://i.sstatic.net/yMRXc.png In mobile view: https://i.sstatic.net ...

Exploring HTML elements using CSS Selectors in Scrapy with Python

Currently, I am working on a personal project to create a web crawler that extracts information from Yahoo Finance. However, I have encountered an issue while trying to pull a specific value from the analysis page on Yahoo Finance. The complexity of the HT ...

How to center a fixed div horizontally using CSS?

#menu { position: fixed; width: 500px; background: rgb(255, 255, 255); /* The Fallback */ background: rgba(255, 255, 255, 0.8); margin-top: 30px; } I've searched high and low for a solution to my problem, but nothing seems to work ...

Having trouble displaying Django CreateView forms on your HTML page?

I have encountered several issues with this particular topic. Unfortunately, I have not been able to find a suitable solution thus far. The CreateView form from models is not loading. models.py from django.db import models from django.contrib.auth.models ...

Display a div every 3 seconds with the help of jQuery

I am seeking a solution to display the second div (box2) every 3 seconds. Can anyone help me achieve this using jQuery? <div id="box1" style="background-color:#0000FF"> <h3>This is a heading in a div element</h3> <p>This ...

Insert title into PDF document

I am currently working on a react application that generates PDF documents easily. The libraries I have utilized are: jspdf html2canvas Below is the code snippet that demonstrates my approach: index.js: <div className="App"> < ...

What can I do to keep my button transparent after it has been clicked?

white button I attempted to create a vertical navigation bar with a background image, but when I clicked the button, it changed to white. How can I ensure that the buttons stay white? I've experimented with primary-outline options I found through my ...

Customizing SharePoint Web Part Styles with CSS: Header Alignment Issue with Body_TEXT

I am currently working on branding a SharePoint website and have encountered an issue with aligning background colors for the title area and body of some web parts. Despite applying background colors, the alignment between the title and body areas is off ( ...

Show only child elements of a specific type within the parent div

Looking to identify divs with the class 'test' that contain only buttons in their child nodes. This is the HTML code that needs to be filtered. <div class="test"> <div> <button> <span>Button 1</span></butto ...

What is the best way to guide users in entering the time in a particular format?

Is there a method to prompt the user for time input in a single bar while enforcing a specific datetime format, ensuring users adhere to the required format? For example: https://i.sstatic.net/WINBS.png ...

Redirecting script upon successful connection detection

I have created a script that checks for internet connectivity using an image, and redirects if internet is available. However, the issue is that it caches the images, leading to attempts to load them even when offline. Is there a different approach I can ...

A square containing two triangular interactive zones

My goal is to divide a square-shaped div diagonally, creating two triangles. Each triangle should respond to the hover event. However, I have encountered a problem where if you move from one corner of the div directly to the opposite corner, the hover eve ...

A guide to examining the HTTP response body, including HTML content, using Wireshark

After entering the URL in the address bar of the virtual machine's browser, a request for an HTML document from my host computer was made. The HTML document, which I had personally written, successfully appeared in the virtual machine's browser. ...

Shaky parallax movement

I recently created a website with a parallax effect, but I'm experiencing some performance issues with jittery movement. The page uses CSS3 transform scale to zoom in and out, and automatically resizes on page resize with JavaScript/jQuery. For the ...

Is it possible that JavaScript isn't functioning properly?

My current issue involves echoing JavaScript from a PHP file to an HTML page using AJAX. Strangely, the JavaScript does not run when dynamically echoed, even though it appears in the Inspect Element tool. On the other hand, purely textual content echoes su ...

Calculate the total width of LI elements and apply it to the parent UL or DIV

Is there a way to calculate the Total LI width and then set the width for the parent div? Here is an example of my code: <ul> <li>dsfdsfdsfds</li> <li>dsfdsfdsfds</li> <li>dsfdsfdsfds</li> <li>dsfdsfdsfds&l ...

PayPal's unsubscribe feature triggers a CSP error

Currently, I am facing an issue while trying to incorporate the Paypal unsubscribe button into my website. The button can be accessed through this link: https://developer.paypal.com/docs/paypal-payments-standard/integration-guide/html-example-subscribe/?ma ...