How do I make a div scroll down by 1 px when a hash href is clicked.
$('[href^="#"]').bind('click', function (e) {
setTimeout(
function () {
$('#freecontent') - 1;
}, 500);
});
i know the above doesnt work. #freecontent is the div and I want it to move down by 1px?
hTML:
<div id = "leftcontent">
<p>
<p class ="currproj">
<a href="#24">Scunthorpe Footbridge</a>
</p>
<p class ="currproj">
<a href="#27">Lorem ipsum dolor sit amet</a>
</p>
</p>
</div>
<div id = "freecontent">
<table>
<tr>
<td>
<a id="24"></a>
</td>
</tr>
<tr>
<td>
<a id="27"></a>
</td>
</tr>
</table>
</div>
You can use scrollTop();
e.g.
Hope that helps 🙂