jquery - anchor linking to a certain position of the page -
I have an anchor link that is linked to another page when it is clicked, by default it Goes to the top of the next page I want this page to be in a certain position. How can I do this (either with jQuery slide effects or normal HTML)?
For example, when the sample is clicked one, I want to bring it to a certain position on the linking page.
OK, so this answer is very specific for your problem.
 The other solution that works is that your  div  element, which matches the anchor, are hidden when pages are loaded. 
 To prove it, click on your links on the home page, and see it  not  work again the hash from  #whatever  to  #bgaboutbody  and you will see it will work properly. 
 So, by doing something like this, it will work for you. Actually, if there is a hash, then it will be cheated at the right place, place it in the script block at the bottom of your page (above the  & lt; / body & gt;  tag) 
  window.setTimeout (function () {if ($ .location.hash) {var $ target = $ (window.location.hash) .closest ("#bgaboutbody"); if ($ target.length $ ('Html, body'). Chetan ({scrollTop: $ Target.offset (. Top}, 1000);}}, 100); Learn how to use Fallback:    It is always better to make sure that your content will be loaded without JavaScript on this type of sale site. (In a web app I think there is a separate discussion). I recommend that you use the solution where you add the  js  class to  html  element  and  gt  page. Then bolster your CSS in such a way: 
   .js #contact, .js #about, etc {display: none}  
  so it is only hidden If JS is present, in addition, since  this  solution is also using Javascript, it is important that if JS is disabled then it still works. 
 
Comments
Post a Comment