Ways to conceal the TippyJS tooltip so it doesn't show up on video embeds

My website has tooltips enabled, but I am looking to hide the tooltip pop-ups that appear specifically over youtube video embeds. Upon inspecting the webpage, I found the code snippet below that is associated with youtube videos:

<div data-tippy-root id="tippy-8" style="pointer-events: none; z-index: 9999; visibility: visible; position: absolute; inset: auto auto 0px 0px; margin: 0px; transform: translate3d(712px, -688.8px, 0px);"> </div>
<div class="video">
 <iframe width="700" height="524" id="youtube_iframe" src="LINK HERE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="height: 446.897px;" aria-describedby="tippy-23">
</div>

I attempted to address this issue by applying some "fixes," however, the changing numbers in the "#tippy-" IDs make it challenging to consistently target and turn off the tooltips for youtube videos. Using selectors like "[data-tippy-root]" or "[id^=tippy]" removed all tooltips from the page entirely which is not my desired outcome. My goal is to specifically target tooltips displayed over youtube video embeds. How can I achieve this?

#tippy-9, #tippy-8 {
    display: none !important;}
#data-tippy-root {
    display: none !important;
    visibility: none !important;}

Answer №1

When it comes to tooltips, the title attribute holds the key information while aria-describedby is purely for accessibility purposes. On Tumblr, only YouTube videos with a specific title attribute display the tooltip. By removing the title attribute and its value (in this case,

title="The Subway is Flooding
), the tooltip ceases to appear. Interestingly, Tippyjs conceals the title attribute from the dev tools' Element page, necessitating manual removal in the HTML source file.

To prevent a tooltip from appearing on an element, simply eliminate the title attribute from that particular element.

Additional Insight:

The Tumblr platform mentioned utilizes the following code snippet to deploy tooltips:

tippy("[title]", {
    ...commonOptions,
    content(reference) {
    const title = reference.getAttribute("title");
    reference.removeAttribute("title");
    return title;
},
});

This script sets up tooltips wherever a 'title' attribute is present. Therefore, defining each tooltip upfront is imperative as modifications post-creation are unfeasible. The dynamically generated "tippy-12" classes likely limit CSS control.

To exert greater influence over tooltips unlike Tumblr's approach, customizing them individually for distinct elements is advisable. This flexibility allows for better management of tooltips. Learn more about creating tooltips - Here

Answer №2

If you want all ID values to start with "tippy-" and end in a random number, you can achieve this using the following CSS selector:

[id^="tippy-"]

The symbol ^ specifies that the selector should start with the specified value.

div {
  width: 50px;
  display: inline-block;
  height: 50px;
  border: 1px solid grey;
}

[id^="tippy-"] {
  background: lightblue;
}
<div id="tippy-1"></div>
<div id="tippy-2"></div>
<div id="tippy-3"></div>
<div id="tippy-456789"></div>
<div id="tippy-5"></div>
<div id="non-tippy"></div>

Answer №3

div[id^="tippy-"] {
  color: red
}
<div id="tippy-1"> para 1</div>
<div id="tippy-2"> para 2</div>
<div id="tippy-3">para 3</div>

Incorporate attribute selectors into your CSS to style elements with matching IDs based on a specific pattern.

Answer №4

Here is a handy selector to target all div elements with an id containing the text "tippy-"

 div[id*="tippy-"] {display: none !important;}

Note: When manipulating someone else's script (such as video embeds), it's best to use a flexible approach like this one (use an asterisk instead of a caret) to avoid future headaches.

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

No testing detected, ending with code zero - NPM and YARN

After installing node js and yarn, I attempted to run an application/script developed by someone else. However, when running the test, I encountered the following message: No tests found, exiting with code 0 Watch Usage › Press f to run only failed tes ...

React child component does not refresh upon modification of an array property

In my main application, I have two subcomponents that both receive the same model property. The first subcomponent deals with a number prop from model.myNumberProperty, and the second subcomponent handles an array prop from model.myArrayProperty. When ch ...

Incorporating user names into socket.io chat for disconnect functionality

I've recently started using socket.io and have been developing a messaging chat feature. By adding usernames to the chat upon login and message submission, everything seemed to be working smoothly. However, I'm facing an issue with retrieving use ...

Leveraging reframe.js to enhance the functionality of HTML5 video playback

I'm struggling with using the reframe.js plugin on a page that includes HTML5 embedded video. When I try to use my own video file from the same folder, it doesn't work as expected. While everything seems to be working in terms of the page loadin ...

The Bootstrap 4 navbar remains consistently visible on mobile devices

I am experiencing an issue with my bootstrap navbar on mobile devices. It remains visible even when the navbar-toggler is collapsed. Below is the code snippet: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <div class="container"&g ...

HTML stops a paragraph when encountering a script within the code

Everything in my code is working correctly except for herb2 and herb3, which are not displaying or utilizing the randomizer. I am relatively new to coding and unsure of how to troubleshoot this issue. <!DOCTYPE html> <html> <body> ...

Extract information from a webpage using JavaScript through the R programming language

Having just started learning about web scraping in R, I've encountered an issue with websites that utilize javascript. My attempt to scrape data from a specific webpage has been unsuccessful due to the presence of javascript links blocking access to t ...

What is the best way to define a variable in EJS?

I need to populate my database array results on the frontend using EJS. The code snippet I'm using is as follows: var tags = ["<%tags%>"] <% for(var i=0; i<tags.length; i++) { %> <a href='<%= tags[i] %&g ...

Executing window.open from Html.Actionlink in ASP.NET MVC 4

Here is the code block I am working with: @foreach (System.Data.DataRow drEquipment in Model.EquipmentList.Rows) { <tr> <td valign="top">@drEquipment["ColumnName"]<br /></td> <td valign="to ...

Adding a simulated bottom border to a rotated container

Currently, I am utilizing the CSS3 rotate value to create an arrowhead effect for modal boxes. However, I now require a full arrowhead design with a bottom border. As this involves rotating a div at a 45° angle, adding another border to either side will n ...

What is the reason behind Ramda having multiple curry functions in its source code, much like Redux having multiple compose functions?

There are _curry1, _curry2, _curry3, and _curryN functions within the depths of Ramda's source code This interesting pattern is also utilized in the redux compose function I find myself pondering: why did they choose this intricate pattern over a mo ...

The ng-app directive for the Angular project was exclusively located in the vendor.bundle.js.map file

Currently, I am diving into an Angular project that has been assigned to me. To get started, I use the command "gulp serve" and then access the development server through Chrome by clicking on "http://localhost:3000". During my investigation in Visual Stu ...

I'm having trouble understanding why my data does not appear even though there is space allocated for it automatically

I'm facing an issue with my code that is supposed to populate a table with dynamic content using react and ant.design. Everything seems to be working fine, but the actual content is not displaying - only the space for it is created. What's happe ...

display a container and navigate to the specific link

Greetings! Could someone please help me make this code function properly? I am attempting to display the DIV (slidingDiv) and navigate to the selected ANCHOR (#anchor-01 + #anchor-02 + #anchor-03)... However, the code currently only allows me to go to the ...

Methods for dynamically adjusting content based on window width in Three.js

Currently, I have implemented a basic window resizing code in my project: function onWindowResize() { windowHalfX = window.innerWidth / 2; windowHalfY = window.innerHeight / 2; camera.aspect = window.innerWidth / window.innerHeight; came ...

An element in CSS that has a position of fixed and a width of 100% surpasses the dimensions of its

My element has the CSS properties position:fixed and width:100%, causing it to be larger than its parent elements. Despite the complexity of my code, I have attempted to simplify it for better understanding. Below, you can see that the green box exceeds ...

Tips on configuring the path to incorporate Bootstrap CSS, JavaScript, and font files/classes into HTML when the HTML file and Bootstrap files are located in different directories

<!DOCTYPE html> <html> <head> <title>Unique Demo</title> <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen"> </head> <body> <div class="container"> <form ...

Tips for determining the duration between the Monday of last week and the Sunday of last week

Can anyone help me figure out how to retrieve the dates from last week's Monday to last week's Sunday using JavaScript? I've searched through various sources with no luck. Hoping someone here can provide some guidance. ...

The output.library.type variable in WebPack is not defined

Currently, I am delving into WebPack with a shortcode. As part of my learning process, I am working on a code snippet that involves calculating the cube and square of a number, which are then supposed to be stored in a variable outlined in the webpack.conf ...

Automatically tapping the Quora "expand" button through code

I am attempting to automate the clicking of the "more" button located at the bottom of a page like using watir. Below is the code I currently have: require 'watir-webdriver' b = Watir::Browser.new b.goto 'quora.com/'+ ARGV[2] + ' ...