scroll to specific div
$("button").click(function() {
$('html,body').animate({
scrollTop: $(".second").offset().top},
'slow');
});
// example: http://jsfiddle.net/ryXFt/3/<div class="first"><button type="button" onclick="smoothScroll(document.getElementById('second'))">Click Me!</button></div>
<div class="second" id="second">Hi</div>
$(window).scroll(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
});
Also in JavaScript:
- search nested array in react javascript
- import bootstrap react
- function redirect javascript
- jquery dialog modal on modal
- Mobx-react console warning related observer
- Vuejs v-model when enter pressed
- js object destructuring with defaults
- how to add toaster in angular 9
- js redirect to relative url
- react chrome extension
- js create object from array
- javascript random number generator
- jstree get data
- razor list to js array
- how to delete a variable in js
- express js post request body
- let scores = [80, 90, 70]; for (const score of scores) { console.log(score); }
- react grid
- collapse in angular 4
- get the state of a checkbox
- async function fetchJson
- start to work with a pre existing react projects
- parseint function javascript
- set onclick javascript