Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmsdsmd sm,dfsadf
1,124 PointsPlease help
Is there way to scroll to green div when I clicked arrow scroll button without having to use scrollTo because I want it to be mobile friendly.
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<style>
*,*::before{
margin:0;
padding:0;
box-sizing:border-box;
}
.arrowButton::before{
content:'';
position:absolute;top:0;
height:3px;
top:50%;
left:50%;
transform:translate(-50%,-50%) rotate(-45deg);
width:23px;
background:red;
}
.arrowButton::after{
content:'';
position:absolute;
height:3px;
top:50%;
left:50%;
width:23px;
transform: translate(-50%,-50%) rotate(45deg);
margin-top:-14.5px;
background:red;
}
.arrowButton{
transform:rotate(90deg) translateX(-50%);
position:absolute;
bottom:0;
left:50%;
background-color:rgba(45,45,45,.01);
}
.home{
position:relative;height:100vh;width:100vw;background:#000;
}
.greenDiv{
height:100vh;width:100vw;background:rgba(45,142,89);
}
</style>
</head>
<body>
```html
<div class="home">
<div
class="arrowButton" style="" tabindex="0" role="button" aria-label="Scroll down"></div>
</div><div class="greenDiv" >
</div><div style="height:100vh;width:100vw;"></div>
<script>
const home = document.querySelector('.home')
const arrowButton = document.querySelector('.arrowButton')
const greenDiv = document.querySelector('.greenDiv')
home.addEventListener('click',function(event){
if(event.target.className ==="arrowButton"){
}
})
</script>
</body>
</html>