I'm a beginner in programming and I'm currently working on creating a variable for my background-position in Javascript/CSS. A developer friend of mine initially wrote the code, but I'm having difficulty assigning my background-position to a variable.
<style>
.frame{
width: 354.1875px;
var viewWidth = 354.1875px;
height: 415px;
background-image: url(https://website.com/image.jpg);
background-repeat: no-repeat;
background-position: 0 50%;
}
.frame1 {
background-position: -1*viewWidth 50%;
}
.frame2 {
background-position: -2*viewWidth 50%;
}
.frame3 {
background-position: -600px 50%;
}
While attempting to use my variable in frames 1 and 2 as researched, it doesn't seem to be functioning properly. Can someone provide assistance with this issue?