OK

CSSJockey websites use cookies to give you a better user experience on our websites. Visit our Privacy and Cookie policy to get more information about cookies, including how you could opt-out.

Expand Images to parent DIV with jQuery and CSS

Working on a WordPress project where client demands all images within a post should extend and touch window borders, ac...

published: 4 years ago

Working on a WordPress project where client demands all images within a post should extend and touch window borders, actually full-size images. The wrapper has a margin of 20px on both sides and it is not possible to remove the margin otherwise, all other elements will require 20px margin.

I got this working with following JS code:

$('.content img').each(function() {
    $(this).css({
        'position': 'relative',
        'min-width': $(window).width(),
        'margin-left': '-20px',
    });
});

In case you have better code for this and in CSS, please share.

 
 

pre-built solutions

Speed-up the launch of your web projects with our ready-to-use plugins, themes and widgets!

This block showcases the features, skills, or services of your business in a 3 columns format along with a title and a s...
This Content Block enlists skills or product features that you can showcase along with a Web Font Icon. A User-friendly ...