1

I know that this question has been asked many times before, but every case is different. To be clear, I have seen similar posts and it didn't give me the answer.

So, I have got this code:

body {
  width: 100%: height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
}

#div1 {
  display: inline;
  height: 100%;
  width: 100%;
  -webkit-transition: all 2s;
  margin-left: 0%;
}

#div2 {
  display: inline;
  height: 100%;
  width: 100%;
  -webkit-transition: all 2s;
  margin-left: 0%;
}

#div3 {
  display: inline;
  height: 100%;
  width: 100%;
  -webkit-transition: all 2s;
  margin-left: 0%;
}

#photo1 {
  width: 30%;
  position: absolute;
  margin-top: 10%;
  -webkit-transition: all 2s;
  margin-left: -6%;
}

#photo2 {
  width: 30%;
  position: absolute;
  margin-top: 10%;
  margin-left: 37%;
  -webkit-transition: all 2s;
  opacity: 1;
}

#photo3 {
  margin-top: 10%;
  position: absolute;
  margin-left: 77%;
  width: 30%;
  -webkit-transition: all 2s;
}

#photo1:hover {
  width: 35%;
  margin-top: 8%;
  margin-left: 2%;
}

#photo2:hover {
  width: 35%;
  margin-top: 8%;
  margin-left: 35%;
}

#photo3:hover {
  width: 35%;
  margin-top: 8%;
  margin-left: 63%;
}

#div1:hover+#div2 {
  margin-left: 2%;
}
<div id="content">
  <div id="div1">
    <img id="photo1" src="https://placeimg.com/200/200/any">
  </div>
  <div id="div2">
    <img id="photo2" src="https://placeimg.com/200/200/any">
  </div>
  <div id="div3">
    <img id="photo3" src="https://placeimg.com/200/200/any">
  </div>
</div>

Code works fine, but I would like to make this to work also backwards (div1 and div2 margin left is set -2 when hover over div3). Any ideas? Thanks!

Namaskar
  • 2,114
  • 1
  • 15
  • 29
Slingy
  • 91
  • 1
  • 10

0 Answers0