8 years ago
4
Topic

Hello, 

I'm trying to create and anchor link in a seblod form, so by clicking a menu link the page jump to content in the same page.

Some help?? :'(

Get a Book for SEBLOD
1283 Posts
Bucklash
8 years ago
3
Level 1

Hi

Do you mean

  1. Click the anchor link in {a) Site Form view, or b) Admin Form view, or c) Content view}, and then be redirected to the page based on the link?, or
  2. Click the anchor link in {a) Site Form view, or b) Admin Form view, or c) Content view}, stay on the same page, but see the content view of the menu item referenced in the anchor link?

Bucklash

8 years ago
2
Level 2

Hello, 

option 2..

I have a very long form displayed in the front end, and a menú (wikipedia style)  to jump to different sections of the form (In the same page) 

1283 Posts
Bucklash
8 years ago
1
Level 3

Hi

Look at this:

// --SCROLL TO ELEMENT--
jQuery(document).on("click", ".scroll-to-content", function(event) {

        event.preventDefault();


        var target = "#" + this.getAttribute("data-target");


        jQuery("html, body").animate(


            {
                scrollTop: jQuery(target).offset().top
            }, 750);


});
// --SCROLL TO ELEMENT END--

Elements with the class "scroll-to-content" have a data attribute called "data-target".

The value of "data-target" becomes the element it scrolls to.


Example:

<p class="scroll-to-content" data-target="my-funky-div">My paragraph text</p>
<div id="my-funky-div"> some cool div stuff </div>


See how that goes, I might have made a mistake in posting the code ;)

Bucklash

8 years ago
0
Level 4

Thank You... Bucklash..

I think It could work! 

:3

Get a VIP membership