I wrote these simple code.my problem is that jquery works but after set scroll position my page is refreshing and settings refer it's default position.how can I stop refreshing?
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function () {
$("button").click(function () {
$("div").scrollTop(30);
});
});
</script>
<body>
<form id="form1" runat="server">
<div style="border: 1px solid black; height: 150px; overflow: auto">
<ul>
<li>
<img width="80px" style="margin-bottom: 5px;" height="70px" alt="" class="img_gallery"
src="Images_slider/1.jpg" />
</li>
<li>
<img width="80px" style="margin-bottom: 5px;" height="70px" alt="" class="img_gallery"
src="Images_slider/2.jpg" />
</li>
</ul>
</div>
<br>
<button>
Return the vertical position of the scrollbar</button>
</form>
return false
from the handler to prevent the default action of button click from taking place
$(document).ready(function () {
$("button").click(function () {
$("div").scrollTop(30);
return false;
});
});