Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
47
rated 0 times [  51] [ 4]  / answers: 1 / hits: 54829  / 10 Years ago, wed, june 11, 2014, 12:00:00

I've searched on google the solution to my problem, and I can't understand why the code I've written work for everyone, but not for me.



I've written this:



<head>
<meta charset=utf-8 />
<title></title>
<script type=text/javascript>
function scrollTo() {
$('html, body').animate({ scrollTop: $('#div_id').offset().top }, 'slow');
return false;
}
</script>
<style type=text/css>
.uno {
height: 1000px;
background: #808080;
}
.due {
margin-top: 300px;
height: 500px;
background: #ff00ff;
}
</style>
</head>
<body>
<div class=uno onclick=scrollTo()>
Clicca
</div>
<div class=due id=div_id></div>
</body>

More From » jquery

 Answers
24
<html>
<head>
<meta charset=utf-8 />
<title></title>
<script src=https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js></script>
<script type=text/javascript>
function scrollTo() {
$('html, body').animate({ scrollTop: $('#div_id').offset().top }, 'slow');
return false;
}
</script>
<style type=text/css>
.uno {
height: 1000px;
background: #808080;
}
.due {
margin-top: 300px;
height: 500px;
background: #ff00ff;
}
</style>
</head>
<body>
<div class=uno onclick=scrollTo()>
Clicca
</div>
<div class=due id=div_id></div>
</body>
</html>


Try this:


[#70624] Monday, June 9, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaleefridad

Total Points: 399
Total Questions: 97
Total Answers: 114

Location: North Korea
Member since Fri, Nov 4, 2022
2 Years ago
;