Для затравки...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<!--
<script src='http://code.jquery.com/jquery-latest.js'></script>
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
</style>
<script type='text/javascript'>
document.addEventListener('DOMContentLoaded',function(){
var o=document.getElementById('menu');
o.addEventListener('click',function(event){
if (event.target.tagName=='A') {
event.preventDefault();
var id = event.target.getAttribute('href');
alert(id);
//top = $(id).offset().top;
//$('body,html').animate({scrollTop: top}, 1500);
};
});
});
</script>
</head>
<body>
<div id='menu'>
<a href='itm0'>Item 0</a>
<a href='itm1'>Item 1</a>
<a href='itm2'>Item 2</a>
</div>
</body>
</html>
Для ознакомления...
http://www.codeharmony.ru/materials/149
|