Is there a way to keep two fixed elements aligned with their sibling element on window resize?
<div class="left-img"> IMAGE HERE </div> <!-- fixed positioned -->
<div class="container"> Lorem ipsum... </div>
<div class="right-img"> IMAGE HERE </div> <!-- fixed positioned -->
Check out this example. Currently, I have set:
top: 50%;
To vertically center them. However, when the window is resized horizontally, the fixed elements should remain aligned with their sibling, the container. How can I achieve this using jQuery or CSS?
I was thinking of something like this
$(window).resize(function() {
$('img').css("right", /*size here*/);
$('.right-side-img');
})
But I'm unsure about determining the window size. Since I am using Bootstrap and all my content is within the container, I want to position an image in the middle on each side while keeping it outside the container.