I have a series of scaling triangles that I've arranged using flexbox, they get bigger and smaller depending on how the window is stretched. I want to have these overlay the bottom of an image to give it a sort of ripped paper or mountain peak sort of effect. The image that they will overlay scales to fit the window and the triangles must follow the image, scaling up and down with the window.
I'm having a lot of difficulty coming up with a solution to this problem and could use some help.
This is how I want the triangles and image to look and relate to one another, the triangles being black in this screenshot and the image being grey.
https://i.stack.imgur.com/1typu.png
Here's a jsfiddle link to the project: http://jsfiddle.net/wD2r2/
CSS:
.triangle-up {
margin: 0 auto;
width: 50%;
height: 0;
padding-left:50%;
padding-bottom: 50%;
overflow: hidden;
}
.triangle-up:after {
content: "";
display: block;
width: 0;
height: 0;
margin-left:-9999px;
border-left: 9999px solid transparent;
border-right: 9999px solid transparent;
border-bottom: 9999px solid #000000;
}
.triangle-container {
display: flex;
}
.overlay {
top: -100px;
left:0px;
right:0px;
z-index: 1;
position: relative;
margin-top: 10px;
}
HTML:
<div>
<div>
<img style="width:100%;" src="images/treeline.jpg" />
</div>
<article class="overlay">
<div class="triangle-container">
<article>
<div class="triangle-up" />
</article>
<article>
<div class="triangle-up" />
</article>
<article>
<div class="triangle-up" />
</article>
<article>
<div class="triangle-up" />
</article>
<article>
<div class="triangle-up" />
</article>
<article>
<div class="triangle-up" />
</article>
</div>
</article>
</div>
I want to avoid the effect of the triangles rising up or down or shifting along the sides of the window in relation to the image. I've been trying to get it to stay constantly running along the bottom and scaling appropriately but with no luck.
Thanks a bunch.