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!

WP Builder Default theme is an installer for a collection of WP Builder Templates and UI blocks. Once you install this t...
This block lets you showcase any video along with two images in a 2 columns format. It can be ideal for showcasing produ...