Mobile displays showing truncated text that is hidden until hovered over

I am seeking guidance on how to display truncated text in an Angular app on mobile devices...

td {
    word-break: break-all;
    overflow:hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
td:hover{
    overflow: visible; 
    white-space: normal;
    height:auto;
}

https://i.sstatic.net/HcHnv.png

While the above code works well for displaying truncated text on a PC, I am encountering difficulties on mobile devices where hover effects are not applicable. This is a new challenge for me and I am wondering if it is possible to achieve a similar effect on mobile devices within an Angular app.

https://i.sstatic.net/pMnrf.png

When dealing with this issue on mobile, I have noticed that there seems to be no straightforward solution. Despite hovering over the textfields, no interaction occurs (as evident from the screenshot).

Thank you all for your input.

EDITED:

<tr>
 <td>
   {{vName.get(name.property)}}
  </td>
    <td id="grid" "" *ngFor="let varT of part[0] && somecode; let i = index">
      {{interpolation}}
 </td>
 </tr>

In the above code snippet, I am trying to implement CSS to truncate text in the td element. However, it seems like achieving the desired effect solely through CSS may not be feasible. One potential workaround could involve utilizing longpress events as suggested in the initial response provided. In summary, I aim to have my text truncated in the td element with hover functionality similar to PCs even on mobile devices. While I do have an alternative solution in mind, I am keen to explore ways to enable hover effects on mobile devices.

Answer №1

When using a mobile device, the hover effect behaves like a click event.

Clicking on it will trigger the hover effect in CSS.

If you click outside of it, the hover effect will blur.

For a different approach, consider using an eye icon to indicate visibility and bind it to touch events. By utilizing touch start and touch end event listeners, you can reveal content when the user presses the eye icon for an extended period.

Find more information at this link:

https://www.w3schools.com/jsref/event_touchstart.asp

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

Generating a list in an HTML document using Django

I need help with printing a list named 'formulario' and inserting it into an HTML file using Django template language. However, I am encountering an issue where I can't display that information within the <li> tag. What could I be miss ...

How can I add a Facebook HTML5 Like Button to AJAX Pages?

I am trying to implement the Facebook HTML5 Like Button on my Ajax views. On my main page, this is what I have: <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById( ...

Wordpress dynamic content enhanced with Bootstrap carousel

My current issue involves a Bootstrap carousel that I've implemented in WordPress. While the carousel itself is functioning properly, I'm having trouble getting it to link to specific articles when the images are clicked on. Can anyone offer advi ...

The menu shifts position or overlaps next to the current active menu option

It would be helpful to take a look at the URL provided (http://ymm.valse.com.my/) in order to understand my question better. Upon clicking on any menu item, I noticed that the menu next to the active tab overlaps. I believe the issue lies in the width pro ...

Error: The value of the expression has been altered after it was already checked. Initial value was 'undefined'. An exception has occurred

Although this question has been asked multiple times, I have read similar issues and still struggle to organize my code to resolve this particular exception. Within my component, there is a property that dynamically changes based on a condition: public e ...

Issue with Jquery Fatnav - active state not functioning properly

Currently, I am implementing a Jquery plugin known as fatNav. The documentation for the plugin can be found here: https://github.com/Glitchbone/jquery-fatNav Although everything is functioning properly, I am encountering difficulty getting my active stat ...

What is the best way to include 2 or more radio buttons in every row of data within a table?

Is it possible to have multiple radio buttons for each row of data in a table? The current code snippet is as follows: echo '<table> <tr> <td>Home</td> <td>Not Home</td> <td>Address</td> <td>Su ...

Interactive Tab content display

I'm working on a tabs component and I need Angular to only render and initialize the active tab instead of all tabs. Is there a way to achieve this? <my-tabs> <my-tab [tabTitle]="'Tab1'"> <some-component></some-co ...

Having trouble injecting ActivatedRouteSnapshot into the component

Struggling to inject ActivatedRouteSnapshot into a component, encountering errors when trying to access query params. Here is the error stack trace: "Error: Can't resolve all parameters for ActivatedRouteSnapshot: (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?). a ...

Utilizing JavaScript event handlers on dynamically appended elements after the document has finished loading

One issue I am facing is with a javasript function that needs to change the value of an element appended after the document has loaded. The problem arises when trying to intercept actions on a newly appended DIV, such as: <div class="new-div"></d ...

Solving issues with Tailwind CSS class names within Next.js

I'm currently working on a project built with Next.js and styled using Tailwind CSS. Unfortunately, I've run into an issue concerning classNames in my page.js file. I've double-checked my import statements, but the error persists. I'm s ...

Utilizing CURL for PHP to extract information from any webpage

Can a PHP function be created to generate an HTML string of any link like a browser does? For example, links such as "", "", "mywebsite.com", "somesite.com/.page/nn/?s=b#85452", "lichess.org" What I have attempted: $curl = curl_init(); curl_setopt($curl, ...

The Intersection Observer fails to function properly with images

I recently discovered that images require different intersection observer code than text in order to function properly. After making the necessary changes to the code, my intersection observer is behaving quite oddly. As I scroll down, the image stays hidd ...

Creating an input field within a basic jQuery dialog box is not possible

Can anyone assist me in adding an input box to my dialog box? I am working with jquery-ui.js. Here is the code I currently have: $(document).on("click",".savebtn",function(). { var id = $(this).attr("id"); $.dialog({ ...

Incorporating a JavaScript library into Angular 7

I am looking to add Cleave.js and Rellax.js libraries to my project. Currently, I have successfully imported jQuery. These libraries require specific attributes in the HTML code. What is the best way to import these libraries? angular.json "scripts" ...

Designing geometric forms using the vertices of a Sphere in ThreeJs

My current project involves creating shapes based on vertices that have already been generated using a formula. I have successfully connected lines between these vertices using a threejs method, but now I want to take it a step further and create map tiles ...

transfer text from one input field to all others

Here is my customized form <form id=form1 method=post accept-charset=UTF-8 action=> <input type=hidden name=video_id[0] value=K94KNsN43BU><p>Title<br> <textarea rows=1 cols=40 id=title_0 name=title[0]>custom title ...

The JSON output displayed my HTML `<br />` as unicode `u003cbr /u003e`, resulting in the `<br />` being shown as text instead of creating a line break

Utilizing ASP.net MVC3, I have retrieved a model in Json format using Jquery.AJAX and am passing it into a Jquery template for rendering. For instance, the Json returned by the server is {"Key":2,"Content":"I'm Jason\u003cbr /\u003ehow are ...

CSS - Adding a Distinctive "Line" to a Navigation Bar

I am attempting to design a unique navbar layout with two "lines". The first line should consist of several links, while the second line would include an HTML select field with a submit button. The following code will generate the desired navbar visual ou ...

Achieving a tidy layout with child divs inside a parent div

I'm struggling to figure out how to arrange objects with margins inside a parent div. Initially, I thought using float would do the trick, but I quickly realized it wasn't the solution. This results in an unsightly amount of space. The divs that ...