The CSS property -webkit-user-select does not seem to be functioning as intended

I'm currently working on a website optimized for iPads and I'm looking to avoid the copy and paste bubble that pops up when users touch and hold on an image. I want something to trigger on touchstart and ontouchend events instead.

Below is my HTML code:

<img class="appImg" src="img/fundMobile.jpg" />

And here is my CSS code:

.appImg{        
    -webkit-user-select: none;
}

Despite adding the CSS property, the copy and paste bubble still shows up when I press and hold on my iPad. Any suggestions on how to resolve this issue?

Answer №1

To prevent default behavior, consider adding e.preventDefault() within the ontouchstart event handler:

yourElement.ontouchstart = function(e) {
  e.preventDefault();
}

Answer №2

Although your css code is accurate, it appears that it may still be cached. This issue seems to occur frequently with iOS 6 UIWebViews. To resolve this, try adding a url parameter to your link. Simply refresh the page after making this change.

<link href="styles.css?cache=12345" rel="stylesheet" />

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

Showing the heading again after a new page starts

Currently, I am using WeasyPrint to generate a document and facing an issue with long sections that may span multiple pages. When a section breaks across pages, the name of the section does not display after the page break as intended. The following examp ...

Displaying or hiding table columns in Vue.js Element-UI el-table based on screen width: a step-by-step guide

Here is my code snippet for generating a table: <el-table :data="tableData" empty-text="No data to display :( " v-if="window.width > 855"> <el-table-column v-for="column in tableColumnsMd" :key=&q ...

Enhance your website design with Bootstrap's unique styling for jumbotron elements

I am currently working on developing a mobile website for calendar events and I need some help. Here is the basic version of the site that I have created so far: The issue I am facing is that the purple backgrounded areas only cover the text, rather than ...

Center text vertically within a Bootstrap grid system

I've searched far and wide on Google, Stack Overflow, and other sources for solutions to vertically align text within my code, but I'm struggling to make it work. My code features a form where users can input a 'doom name' and the text ...

Altering the placement of a single element from floating to fixed positioning in CSS

Currently in the process of designing a basic website, I am looking to modify the behavior of the navigation bar on the left-hand side. I want it to remain fixed in its position so that users can scroll through the page without losing sight of it. My main ...

Every time I attempt to insert a background image into a div using jQuery, I am consistently faced with a 404 error message

When I hit enter in my search bar, a new div is created each time. However, I am struggling to assign a background image to the created div as I keep receiving a 404 error in the console. Below is the code snippet I'm working with: function appendToD ...

Achieving uniform alignment of multiple field labels in Bootstrap and Simple Form

Here is the current layout of my form: https://i.sstatic.net/2vZjl.jpg You may notice that the labels are not properly aligned. I would like them to appear like this: https://i.sstatic.net/gm39D.jpg Below is the code for all the input fields: <%= si ...

CSS text width going from left to right

I am attempting to create a text fade effect from left to right, inspired by the technique discussed in this answer. However, I would like the text to be concealed behind a transparent background div instead of the white background used in the example. I ...

Issues with uploading files

I am trying to implement a functionality where users can upload video, audio, images, PDFs, PowerPoint presentations, and Word files, and then have them saved into a directory. However, when I try to upload the files using my code, there are no errors but ...

Sliding Up Transition Effect for Footer with JQuery or CSS3

I am attempting to replicate a sleek slide up footer that caught my eye on The Internship Movie Site. I have created the wireframe layout, but I am struggling to figure out the correct CSS transition effect. Although I have experimented with the "top" and ...

Embedding a Material-UI Icon into an Input Field within a React Application

Hello, I am currently using a datepicker provided by Material-UI Datepickers. When utilizing the Inline datepicker option, I would like to include a calendar icon within the input field. Below is the code snippet representing the input element. How can I ...

Unable to show PHP results in HTML

I've tried many solutions from different articles, but none seem to work for me. I would greatly appreciate any assistance in displaying the Full_Name field within an HTML element on my webpage. Below is the content of the PHP file: {"Test_Info": { ...

Data bindings encapsulated within nested curly braces

I am currently utilizing Angular2 in my application. Within my html file, I have a *ngFor loop set up like so: <div *ngFor="let element of array"> {{element.id}} </div> Next, I have an array containing objects structured as follows: some ...

Eliminate HTML tags and formatting, but retain the anchor tags within the string

I have a string variable with HTML content that I need to clean up by removing all tags and formatting, while still preserving anchor tags for clickable links. content = "<div><a href=\"1\">I</a> was going here and then <a h ...

Enhancing page accessibility through the implementation of shortcuts

Greetings to all members of the community! I am currently in the process of improving a website by implementing better accessibility practices. I have some concerns regarding a page that displays a large number of repeated result blocks, each containing ...

Start the CSS3 animation in reverse right away

I am trying to achieve a "flashing" effect by adding the .shown class to my #overlay, causing the opacity to fade in for 2 seconds and then immediately reverse, fading out for another 2 seconds. After experimenting with removing the class, I found that it ...

Steps for Deactivating Past Dates on JQuery Datepicker1. Open your

I've been working on a custom JQuery Calendar for selecting appointments, with the requirement to disable dates prior to the current date and highlight available dates in an orange color (#f48024). Unfortunately, my attempt using minDate hasn't b ...

Combine lists with floating elements positioned to the left or right

My HTML includes the following ul tag: <ul style="position:absolute"> <li>list 1</li> <li>list 2</li> <li>list 3</li> <li> list 4 <p>list 4 content goes here</p> ...

"Transforming the Website Background with a Splash of Color

I am trying to figure out how to change the color scheme of my website with a button click. Currently, when I select a different color, only the background of the webpage I'm on changes, not the entire website. I have applied CSS but it's not ref ...

Error: Attempting to access 'position' property of undefined object in ThreeJs is causing a TypeError

I am currently facing an issue with integrating a 3D model into the background of the hero section on my website. The integration works fine, but I noticed that when I manually resize the window, the 3D model does not adjust to the new size. Additionally, ...