The image does not adjust size properly on mobile devices

How can I enable pinch-zoom and the ability to move around to view an enlarged image on mobile devices?

https://i.sstatic.net/6JGRh.png

Despite trying to add user-scalable=yes to the viewport meta tag, the image remains fixed within the viewport. Any suggestions on how to fix this issue?

Test the page here:

Is there a different approach I should take to make the image zoomable and movable on mobile devices?

Answer №1

A clever way to showcase an image is to let it maintain its original dimensions while placing it in a smaller container. Avoid using object-fit: cover or contain, allowing users to interact with the image freely, move it within the container, and zoom in for a closer look.

Consider the specific requirements of your webpage - for instance, you may want more of the image visible in its static state without user interaction. On a smaller device, providing the option to view the image in fullscreen before zooming can enhance clarity, especially for tasks like 'spot the ball' where precision is crucial.

Use this basic code snippet to kickstart your project:

.container {
  width: 300px;
  height: 200px;
  overflow: auto;
  margin: 50px;
}
img {
  position: relative;
}
<div class="container">
  <img src="https://i.sstatic.net/RxX4s.jpg" />
</div>

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

Adding a PDF generated from an HTML div to an email using Java

I am looking for a solution to convert the contents of an HTML div tag into a PDF file while preserving its associated CSS. This is essential as I will be using Java on the back-end to send emails, and I need to attach the PDF with the CSS intact when send ...

Can someone help me figure out how to make my Dropdown stay open when I highlight input, drag, and release

While working with the react bootstrap Dropdown component, I've encountered a specific behavior that is causing some trouble. To better illustrate the issue, I've attached some images. In my dropdown, there is an input filter box along with a li ...

Content is cleared from the leaflet popup upon first closure

In my application, I've been working extensively with Leaflet and have a good grasp on the "leaflet way" of doing things. Since I have a single static layout for all my markers, I decided to create a simple Mustache template to insert variable data a ...

Navigational dropdown menu item vanishing upon hover

Utilizing bootstrap for my website, the main navigation employs dropdowns for secondary choices. I am encountering an issue in IE10 only (works fine everywhere else) where the dropdown menu is inconsistently accessible. Additionally, if you manage to acce ...

The bottom portion of my page vanishes without a

My footer has the following CSS class: .footer{ border-top:solid 2px #BBB; background : url('../images/footer.png'); font-family : helvetica; font-style : italic; height:9em; clear: both; color: black; wid ...

jQuery plugin stops functioning properly following the use of the jQuery display block method

In my project, I am exploring the use of divs as tabs with jQuery. Within these divs, I also want to incorporate another jQuery plugin. Currently, I have manually created these div tabs using jQuery and set the default style for second and subsequent divs ...

What is the best way to arrange elements based on the numeric value of a data attribute?

Is there a way to arrange elements with the attribute data-percentage in ascending order, with the lowest value first, using JavaScript or jQuery? HTML: <div class="testWrapper"> <div class="test" data-percentage="30&qu ...

When viewing a webpage on a small browser, the content will automatically expand to fill the

Attempting to utilize responsive CSS media queries to hide the sidebar unless the screen is large or a tablet big enough in landscape mode. It appears to be functioning properly while resizing the browser, but at a certain size, it occupies the entire scre ...

Tips for positioning two fields side by side on a webpage with CSS

I currently have two datepickers aligned vertically and I'm looking to display them in a horizontal layout with some spacing between them. What changes do I need to make in order to present these two calendar pickers side by side on the same row? Cou ...

Position the text alongside the Facebook emblem

I am having trouble getting the text Follow Us to align on the far right next to the Facebook Icon. I added the float:right property, but it is not working as expected. Here is the code snippet: <a href="#" target="_blank" style="font-family: Arial, ...

Validation is performed on the Bootstrap modal form, ensuring that the modal is only loaded after the

In order to provide a better understanding of my website's file structure, I would like to give an overview. The index.php file dynamically adds many pages to my website. Here is the code from index.php: <?php include ('pages/tillBody.php ...

Malfunctioning jQuery Plugin

Currently attempting to implement a jQuery plugin to achieve a pagination effect similar to The plugin I came across is linked at Although the usage seems straightforward, I am encountering difficulties making it function correctly. Displayed below is t ...

unable to choose an option if more than one radio button is being used

I am having trouble with two radio buttons that are supposed to select the gender of an applicant and the gender of the applicant's child. Both buttons are not functioning properly. Can someone assist me with this issue? Here is the code I am using: ...

Is there a way to display x-overflow on a table instead of the window?

Check out the table at the following link: In my CSS, I set a min-width and overflow-x property for the table. However, on the mobile template, the overflow-x does not work properly. I want the template to display correctly with the header and footer in ...

What steps can be taken to update the cart if all products have been removed?

How can I implement a refresh for my cart page every time the product length is 0 without causing unreachable code? It seems like there must be a simple solution to this problem. switch (action.type){ case "REMOVE_PRODUCT": return ...

What is the simplest method to create a scroller for engaging narratives?

I am in the process of creating a static but responsive storytelling website using HTML. My objective is to create an effect similar to this: https://i.stack.imgur.com/zIEpU.gif The idea is to have text on the left and a *.jpg image fixed on the right. As ...

How can I adjust the height of an iframe dynamically using AngularJS?

I wrote a function that resizes the height of an iframe element to always be 100% after it loads: app.directive('iframeAutoSize', [function() { return { restrict: 'A', link: function(scope, element, attrs) { ...

Stylish CSS for your website's navigation

I am facing a challenge with creating a menu for my website. I want it to be positioned on the left side, similar to the image provided below. However, despite writing the code and applying styles as expected, the menu does not display correctly and appear ...

How can I target all ul elements except those contained within a div with a specific class using CSS?

In my global.scss file, I have defined global styles for ul elements as shown below: ul { list-style: none; margin: 0; padding: 0; } However, I am trying to find a way to style all ul elements except those within a specific jodit-wrapper class ...

How can I prevent users from using the inspect element feature in Angular 4?

I have a collection of elements that I need to selectively display on a webpage. To achieve this, I am utilizing the following code snippet: [style.display]="!student.selected?'none':'block'" However, upon inspecting the element, a ...