1
私はAngularJSを使用してウェブサイトを構築しています。しかし、私はjQueryに精通しています。私のウェブサイトでは、ボタンをクリックすると具体的な<div>
にスクロールしたいです。私はこれのためのコードをjQueryに持っています。しかし、私はAngularJSに同じコードを書く方法を知らない。 AngularJSに同じコードを書く方法を教えてもらえますか?ここで円滑に部門にスクロール
はスニペット
$('#todivone').click(function() {
$('html, body').animate({
scrollTop: $('#divone').offset().top
}, 'slow');
});
$('#todivtwo').click(function() {
$('html, body').animate({
scrollTop: $('#divtwo').offset().top
}, 'slow');
});
$('#todivthree').click(function() {
$('html, body').animate({
scrollTop: $('#divthree').offset().top
}, 'slow');
});
div {height: 900px; border:2px solid #333; padding:10px; margin: 0px;}
button {position: fixed; margin-top: 50px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="todivtwo">GOTO DIV 2</button>
<br>
<button id="todivthree">GOTO DIV 3</button>
<br>
<button id="todivone">BACK TO DIV 1</button>
<br>
<div id="divone">DIV CONTENT 1</div>
<div id="divtwo">DIV CONTENT 2</div>
<div id="divthree">DIV CONTENT 3</div>
あなたは* *たくありませんAngularコントローラでDOMを操作する。 [それ以上](http://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background) – isherwood