I would like to set the widths, heights and positions of some images for when they are enlarged in JavaScript. This enlargement will be achieved by linking to the current location with the specific image targeted (e.g example.com#image-1).
My plan is to just use JS to set the sizes and positions of the elements when they are targeted, and to perform this function on page load and on window resize. I would then handle the transition (enlargement of the image) in CSS. I know jQuery has a :target selector but I'm not currently using jQuery.
<img src="example.png" id="image-1">
<style>
#image-1 {
height: 100px;
width: 200px;
position: absolute;
top: 0;
left: 0;
}
#image-1:target {
//I would like to set this in js
//based on screen size etc
}
</style>
Any help would be greatly appreciated!