safari not working
by dxokoya
HTML
<script src="https://cdn.jsdelivr.net/npm/vue-scrollto"></script>
<div id="app">
<div class="button-wrap">
<a class="button" @click="safariNotWork()">click here!</a>
</div>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<p id="message">message</p>
</div>
SCSS
.button-wrap {
display: flex;
gap: 10px;
}
.button {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
width: 100px;
height: 30px;
background: #ccc;
}
ul {
padding: 0;
li {
display: block;
height: 200px;
width: 100%;
list-style: none;
&:nth-of-type(even) {
background: #ccc;
}
}
}
Vue
new Vue({
el: '#app',
data: {
},
methods: {
click() {
this.scrollToMessage();
},
safariNotWork() {
const element = document.getElementById('message');
element.scrollIntoView({
behavior: "smooth"
});
}
}
})