Expanding the Width with jQuery"

I have been working with jQuery and trying to apply the max-width property to my images affected by jQuery without success. Can someone please assist me? Below is the code I have been working with:

<!DOCTYPE html>
    <html>
    <head>
    <title>Test</title>
    </head>

    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>

    <script>
    $(window).load(function () {
    setTimeout(function () {
    $('div.fade > div') . fadeIn(3000) // 3 second fade in
    }, 2000) // after 2 seconds.
    })
    </script>


    <style>
    .img{
        max-width: 100%;
    }
    html
    {
        background-image:url(purplegrad.png);
        background-position: center;
    }
    .container
    {
        position:relative;
        margin-top:100px;
    }
   .fade
   {
        position:relative;
        width:800px;
        z-index:1;
        margin:auto;
    }
    .inside 
    {
        position: absolute;
        display: none;
        z-index:2;
        top:0;
        left:0;
    }

  </style>

    <body>
        <div class="container">
            <div class="fade">
                <img class="img" src="namelarge.png" />
                    <div class="inside">
                        <img class="img" src="nameglow.png" />
                    </div>
            </div>
        </div>
    </body>

    </html>

Furthermore, someone from the jQuery forum provided this helpful example of my jQuery implementation: http://jsfiddle.net/jakecigar/HS2f9/

Answer №1

I'm a bit unsure of exactly what you're searching for, as there's no mention of a maximum width in the provided sample. However, I believe you're aiming for:

.fade div img {
        max-width: 100%;
}

By adding this code, your second image should display correctly.

Click here for an example

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

What are your thoughts on nesting an "li" tag within an "a" tag?

Consider this scenario: <ul> <a href="http://google.com"><li id="someId"></li></a> ... ... ... </ul> This is a solution I came up with to work around my current css styling. Now, I'm debating whether or not to ref ...

Can a Material UI Select element be made unresponsive to hover effects?

When a user hovers over an element, I want to achieve the following functionality: document.getElementById("dropdownCategory").disabled = true; <Tooltip arrow placement="right" title={props.description} > <FormControl id="dro ...

Loop through 3 items in jQuery and repeat each item by decrementing it

I need to develop a jQuery function that will increment or decrement a value every 3 seconds using the window.interval method. Here is the desired sequence: 1st: 1, 2, 3 After 3 seconds 2nd: 3, 1, 2 After 3 seconds 3rd: 2, 3, 1 After 3 seconds 4th: 1, 2, ...

What is the best way to differentiate between words enclosed in quotation marks using colors?

Working on my shop, I've added a section for "Colors available", but now I want to color different words with different colors using Javascript, CSS, or HTML. <button onclick="getColors()">Colors Available</button> <script> ...

Top strategy for incorporating text into a logo design

My goal is to create a logo similar to the image below, with the black rectangle as an image and the text as real text. I have tried the code below (also available on jsfiddle http://jsfiddle.net/ueZ2H/ and it seems to be working. However, I am unsure if t ...

Executing memory function with JQuery replaceWith() and event handlers

Imagine you have the following HTML code: <button id="click-me" type="button">Click Me!</button> Now, picture this jQuery snippet being executed: var button = $('#click-me'); button.on('click', function() { console.l ...

Reordering an action button on the WooCommerce My Account Orders page

How can I ensure that a specific action button remains at the top of the list on the WooCommerce My Account Orders page? I have a plugin that adds a "track" button once an order is shipped, and I want this button to always appear first in the list, even t ...

Attempting to align input fields and spans side by side

Is there a way to properly align multiple inputs next to each other with dots in between, resembling an IPv4 address? Currently, the span appears to float in the center. How can this be resolved? It's worth noting that all elements in the image have b ...

Tips for referencing page URLs in a jQuery Ajax request within a Master Page in ASP.NET

I have successfully implemented a webmethod call from the Master Page in my asp.net project. In my solution explorer, the "Master Page" and "MyService.asmx" files are located in the root folder, while the content pages are inside an "Admin" folder. When I ...

What about a lightbox with enhanced jQuery features?

As a newcomer to jQuery, I've never experimented with lightboxes before. However, I was tasked with creating something fun for April Fools' Day at work. Naively, I accepted the challenge thinking it would be simple, but now I find myself struggli ...

Tips for choosing an item within a div -> ul -> li using Selenium

I need help with a menu that displays a list on mouse hover, and I'm trying to click on "Logout". However, the code I've written so far is not giving me the desired result. This is the Java code I have: public void logout() throws Exception { ...

jQuery ajax doesn't function properly on the server, it only works locally

When I send a jQuery Ajax request from my front-end to the back-end to retrieve values for calculations, it works perfectly on my local web server. However, when I try it online, all I get is a result of 0 in my calculations, indicating that the Ajax respo ...

Performing cross-origin GET request

I need help with a scenario involving a link and some JavaScript code. The setup is as follows: <a id="link" href="https://yahoo.com" target="blank">Link</a> Here is the script I'm using: var security = function() { var link ...

Dealing with a jQuery/JavaScript issue involving thumbnail images

I am facing an issue with smooth transitions between thumbnail images in HTML list tags. I have Jquery listeners set up for mouseenter and mouseleave events that update a parent image when a thumbnail is hovered over. The problem arises when scrolling fro ...

Retrieve various forms of information using Ajax

Currently, I am working on developing a social networking website similar to Facebook using PHP. On one of the pages titled showdetails.php, I have implemented a search bar that should display a dropdown list of user names from the database as the user typ ...

The rel=preload attribute for the stylesheet is not properly rendering the styles after being downloaded

Exploring the use of rel=preload for the first time, specifically for a few stylesheets. Check out the code snippet below: <link rel="preload" href="css/styles.css" as="style"> <link rel="preload" href="//allyoucan.cloud/cdn/icofont/1.0.0beta/css ...

Jquery - Ajax: Error in Syntax JSON.parse: character not expected

I am encountering an issue with parsing JSON data on my client-side code. The JSON received from the server looks like this: [{"name":"Bubble Witch Saga 2","impressions":10749},{"name":"Grinder","impressions":11284},{"name":"Loovoo","impressions":12336},{" ...

Refreshing CAPTCHA with the power of PHP and jQuery

Seeking advice on how to dynamically renew the captcha image created by a php script when the "captcha_refresh" is clicked. My current solution works well only in Google Chrome, with other browsers not recognizing it. HTML <img class="captcha_image" s ...

What causes my unordered list to vanish when I use the CSS float: right property?

Can anyone explain why my ul element disappears when I apply the float: right property in CSS? I'm currently working on the navigation for a website project. You can view the code snippet on CodePen by following this link: https://codepen.io/maximo ...

How can I use query to swap out elements within a div when clicked?

I have a project with two separate div classes named demo-heart and demo-coal. The goal is to implement functionality that allows the user to click on the fa-heart icon and have it switch to fa-coal, and vice versa when clicking on fa-coal. <div class ...