Creating an icon to serve as a placeholder

I attempted to create a placeholder image in jQuery Mobile, but unfortunately was unsuccessful. You can view what I am trying to achieve by following this link. Below is the code I used to make the "Icon of Expedia" act as a placeholder - when someone touches the icon on mobile devices or clicks on it from desktop browsers, a blue square will cover the icon and make it stand out.

<div data-role="content">

     <ul data-role="listview" data-inset="true" data-dividertheme="b">
                    <li>
                        <img alt="Hotels.com" src="images/H.jpg" />
                        <div style="margin-top: 0px; width: 53%; float: left;">
                            <a style="font-size: 10px; color: Black;">Great Deal- Collect 10 nights and get 1 free
                                at Hotels.com</a>  
                    </li>
    </ul>
</div>

Answer №1

To achieve this effect, you would utilize the :active CSS selector.

Check it out here: http://jsfiddle.net/2N7Ja/3/

Here is the HTML snippet:

<ul id="list">
    <li class="cf">
        <span class="wrapper">
            <img src="image.png"/>
        </span>
        <a>Great Deal- Collect 10 nights and get 1 free at Hotels.com</a> 
    </li>
</ul>

And here is the CSS code:

img { display: block; }
#list { list-style: none; }
#list, #list > li {
    margin: 0;
    padding: 0;
    border: 1px solid #ccc;
}
#list > li > a {
    display: block;
    float:left;
}
.cf:after {
    content:"";
    display:table;
    clear:both;
}
#list img {
    float: left;
    padding: 2px;
}
#list > li:active img {
    border: 2px solid blue;
    padding: 0;
}

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

"Enhancing selector parsing with the use of pseudo-elements for improved forgiveness

Is there a way to streamline CSS code using forgiving selectors like :is or :where with pseudo-elements in native CSS only? The documentation states that :is cannot be used with pseudo-elements, but I'm wondering if there's another solution that ...

The header and sub-navigation are in disarray and require some help

Dear web experts, After six months of learning to code websites, I'm tackling a big project with some challenges. The recent changes to the header and subnav have thrown everything off balance, making it look wonky and not quite right. Specifically, ...

What is the best way to locate {Tags} only within the visible HTML content, excluding the elements' attributes?

Is it feasible to extract a specific pattern using only regexp (and possibly php) that falls outside of one pattern but within another in php (or maybe with ?R in php regexp for the recursive aspect)? The objective is to locate the tags between > {This ...

Populate the form fields with data extracted from the uploaded CSV file

My latest project requires me to transform the uploaded CSV file from the first page into a form. This form should be pre-filled with the data from the CSV file to make editing easier. Currently, I have a working CSV upload feature. However, I need to hav ...

Instructions on how to extract a specific timestamp from a video and utilize it to initiate an event

Is there a way to trigger an event or animation at a specific time in a video or frame of the video? For instance, I want text to appear when a video reaches 30 seconds. I've experimented with currentTime, tried using loadeddata, and attempted to u ...

Retrieve the report information and present it in a HTML data table using a REST API

My understanding of REST API and Javascript is limited, but I now find myself needing to interact with a third-party company's REST API for email reporting purposes. The data can be accessed through a GET method using a URL with a specific TOKEN: {pl ...

"Optimizing App Pool Performance with IIS Precache Event Monitoring

Our asp.net LOB web application is quite large. The issue we are facing is the delay of up to 10 seconds when the app pool is started or recycled, making the first page load slow. This results in users seeing a white page with a loading spinner until IIS ...

Change the class upon clicking the element

Looking to create a function that toggles classes on elements when specific links are clicked. For example, clicking on link 1 should add the "active" class to the red element, while clicking on link 2 should do the same for the pink element, and so forth. ...

Customize the bootstrap carousel to show multiple slides at the same time

I am looking to customize the bootstrap 3 carousel in order to show multiple slides at once. I understand that I could place several thumbnails in a single slide (div .item), but the issue is that the carousel will progress through them all at once, moving ...

A multimedia player featuring various video source files and multiple text track options

My issue involves a video element where the user can choose from a list of options to play. Each video has an associated text track, but I am having trouble setting the new text track when a different video is selected. In my html, I have: <video id ...

Adjusting the size of h1 when hovering over an image

Can anyone help me figure out how to increase the width of my h1 tag when hovering over the image? I've been struggling to make it work. http://jsfiddle.net/xJ4dc/ Thank you in advance for any assistance. ...

Icons are now toggling for all items, not just one

Within my Angular 2 application, I have implemented a collapsible and expandable menu. The issue I am facing is with the toggling of icons - when expanding one menu item, the icon changes correctly but it also changes for all other menu items that are not ...

Creating a Naming Convention in JavaScript for Object Properties based on Specific Criteria

Sorry for the vague title, I couldn't think of a better way to describe my issue. Currently, I'm working on a basic script that extracts data from another website and then, after customizing the data, converts the results into JSON. The code is ...

Tips for eliminating null values from a JavaScript object

I am currently facing an issue with a JavaScript object that consists of two arrays. At times, one of the arrays might be empty. I am attempting to iterate through the object using a recursive function, but I want to exclude any empty arrays or strings fro ...

The fit-content max-height property is not functioning properly in Firefox

This CSS approach is effective in browsers like Chrome. p.ex1 { max-height: fit-content; height: 250px; border:solid 1px black; overflow: auto; } The goal is to utilize the full height, allowing scrolling when necessary, while also adjusti ...

What is the best way to ensure a consistent fixed-width layout viewport in Android and iPhone while allowing for user scalability by using jQuery Mobile?

Ensuring that the website has a fluid layout is essential, adapting to the width of the device in both portrait and landscape orientations. The meta viewport tag I am using is as follows: <meta name="viewport" id="viewportid" content="width=device-widt ...

PHP reports array size=0 after successfully sending an array of JSON objects to it using jQuery AJAX

I have an array of json objects like this: var jsnObjs = [{"key": 0, "data": 1}, {"key": 1, "data": 2}]; When I check the output of console.log(jsnObjs) in chrome, it shows: (2) [Object, Object] 0: Object key: 0 data: 1 proto: Object 1: Object key: ...

Interactive Ionic menu available on a designated page for enhanced user engagement

English is not my first language, so please bear with me. Here's the situation: I have a map section (using leaflet) on one page of my app, along with a menu for displaying data to the user. Currently, the menus are located in my app.component.html b ...

Submitting information via jQuery

https://i.stack.imgur.com/VU5LT.jpg Currently, I am working on integrating an event planner into my HTML form. However, I am facing difficulty in transferring the data ("meetup", "startEvent", "break") from HTML to my database. Using jQuery, I was able to ...

Unable to save Ajax data in session array

Currently, I am developing a cart system using jquery, ajax, and php. The issue I am facing is that the text within the HTML elements is not being added to the session array. Below is the ajax code I am using: $(document).ready(function(){ $("#car ...