I'm currently working on a photo gallery project and my goal is to have the images rotate when hovered over. However, I am experiencing difficulties in passing values from TypeScript into the CSS.
HTML
<div class="back">
<div class="row">
<div class="column">
<img src="https://images.unsplash.com/photo-1558981359-219d6364c9c8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80" style="width:100%">
...
...
CSS
.back {
background-color: var(--grey1);
padding-bottom: 28px;
}
* {
box-sizing: border-box;
}
...
...
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.column {
-ms-flex: 100%;
flex: 100%;
max-width: 100%;
}
}
TypeScript
export class PhotosComponent implements OnInit {
random = Math.random(); //I am attempting to utilize this value in my CSS
constructor() { }
ngOnInit(): void {
}
}
In an attempt to modify the rotation effect, I have explored using [ngStyle] in the HTML file. However, it seems that the rotation cannot be altered in this manner.
For reference, you can view a JSFiddle demonstration here: https://jsfiddle.net/6okvLu7a/