<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<link href="font-awesome.css" rel="stylesheet">
</head>
<body leftmargin="0px" topmargin="0px" >
<div class="header">
<div class="head"><div class="logo"><img src="logo.png"></div>
<div class="menu"><a href="#main" >menu</a></div>
</div>
<div id="main">
<section id="nav">
<ul><li><a href="#">Home</a></li>
<li><a href="#new">Events</a></li>
<li><a href="#tech">Technical</a></li>
<li><a href="#">Schedule</a></li>
<li><a href="#">Contact</a></li>
</ul>
</section>
<div id="new"><h1 align="center">Content changed</h1></div>
<div id="tech"><h1 align="center">Technical event</h1></div>
</div><br>
</body>
</html>
我想在点击时停止跳转到id =“main”并想要停止所有锚点#new链接停止滚动并且跳转页面应保持原样
答案 0 :(得分:0)
我猜你正在将事件监听器附加到链接上。以下是我使用您的代码提出的示例:http://jsfiddle.net/Rdsxk/
$(selector).on('click', function(){
//add code you want to execute here
return false
});
Selector
将是您不想滚动的链接类。