TextAfter that, the page should go toid , without...">Geek Answers HandbookJQuery go to id (no animation)Script adds idfor the block, gives:<div id="some">Text</div> After that, the page should go toid , without animation, just like we have targeting #somethe link of the current page.How to do it?Thank.+5jquery targetHappy Jun 11 '10 at 14:31source share4 answersYou mean the link to the "old school" like # somefor example<a href="#some"></a> Done in JS usinglocation.href = "#some"; +10Pez cuckow Jun 11 '10 at 14:39source shareTry the following: document.getElementById('some').scrollIntoView(true); +19unomi Jun 11 '10 at 14:38source shareLike this:location.href = "#some"; +3SLaks Jun 11 '10 at 14:34source share$('a[href^="#"]').click(function() { $('html,body').animate({ scrollTop: $(this.hash).offset().top}); return false; e.preventDefault(); }); +2Avinash saini Apr 7 '14 at 11:12source shareMore articles:Open Space Optimization Algorithm - optimizationDead end in SQL Server 2005! Two real-time battle bosses are fighting. WHAT FOR? - sql-server-2005URL Repeater URL Parameters SEO - seoBinding MVC Models to Interfaces - c #Throw an exception when reassigning a constant in Ruby? - ruby | fooobar.comHow to notice unusual news activity - language-agnosticCompiling code at runtime, loading into the current appdomain, but Type.GetType can not see it - compiler-constructionUnicode printing in pydev eclipse console and in standby - pythonIs it possible to run a Java run in a program? - javaCannot use PyDev console for Eclipse (Luna) using UTF-8 - eclipseAll Articles
Script adds idfor the block, gives:
id
<div id="some">Text</div>
After that, the page should go toid , without animation, just like we have targeting #somethe link of the current page.
#some
How to do it?
Thank.
You mean the link to the "old school" like # some
for example
<a href="#some"></a>
Done in JS using
location.href = "#some";
Try the following:
document.getElementById('some').scrollIntoView(true);
Like this:
$('a[href^="#"]').click(function() { $('html,body').animate({ scrollTop: $(this.hash).offset().top}); return false; e.preventDefault(); });