0

I am trying to point a hyperlink to a separate page and then it scrolls down to a particular section.

I have found a post in which someone has found solutions; however, because I am somewhat of a novice, I don't know where to start the PHP code. Could anyone be so kind as to teach me? Would I publish this in a new PHP document or in the theme document?

Here's the link: jQuery scroll to ID from different page

var jump=function(e)
{
   if (e){
       e.preventDefault();
       var target = $(this).attr("href");
   }else{
       var target = location.hash;
   }

   $('html,body').animate(
   {
       scrollTop: $(target).offset().top
   },2000,function()
   {
       location.hash = target;
   });

}

$('html, body').hide();

$(document).ready(function()
{
    $('a[href^=#]').bind("click", jump);

    if (location.hash){
        setTimeout(function(){
            $('html, body').scrollTop(0).show();
            jump();
        }, 0);
    }else{
        $('html, body').show();
    }
});

By the way, I need the scrolling to happen so the viewer understands there is more content on the page and I need to be able to control the speed of the scroll and the location in which is set.

Currently I've been using the Jump but it is not scrolling and It is landing on the section showing in the very top and not in the center of the screen.

Any thoughts or help on this ?

Community
  • 1
  • 1

0 Answers0