Button to link to specific place on page?


(Mark) #1

HI!

I’m getting closer to wrapping this project up…again as a non-programer person…this software is amazing.

I have searched the forums and don’t quite understand how to make a couple things work.

If I understand correctly to cannot use a button to link to a specific pixel height Y value for the page but I CAN to a DIV ID? Is that correct?

But how do I assign with HYPE a DIV ID to a specific place or thing on the page…say for example the CONTACT form or other text box?

Also I would like to scroll as opposed to jump if possible… I searched the forum and found the following code I copied below. Again sorry for the newb ignorance… Is that something that goes in the header?

Thanks so much for your time! I love learning this stuff…wish I was better at it. :grinning:

The site is here is you wanna look at it… http://www.annafaye.com

Scrolling…

$(function() {
$(‘a[href*=#]:not([href=#])’).click(function() {
if (location.pathname.replace(/^//,’’) == this.pathname.replace(/^//,’’) && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $(’[name=’ + this.hash.slice(1) +’]’);
if (target.length) {
$(‘html,body’).animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});


#2

Here’s how to link to a specific Y height:

  1. Create a ‘Mouse Click’ --> ‘New JavaScript’ action
  2. Insert this code within the JS editor: window.scrollTo(0, 10); (Where 10 would be the Y pixel height you wish to jump to.

If you set an ID on any element, for example contact, then you can link to it by inserting this in the ‘go to URL’ field: #contact for your Mouse Click --> GO to URL field.

For smooth scrolling, please check this example by @MarkHunte : Smooth Scrolling Additional coding help

It has a few examples on jumping to specific points and to the top.