1

Just wondered if its possible to make a newly loaded page jump to a id ? with or without javascript

like the old fasion way of having links to jump the same page. goto 4 would jump to jump here

Can this be archived on load ? if forexample my link is in segment_2

thats all :)

2 Answers 2

3

Sure. You'd just need something like this is in your template:

{if segment_2!=''}
<script type="text/javascript">
$(document).ready(function(){
$.scrollTo('#{segment_2}');
})
</script>
{/if}

That's assuming you have some sort of "scrollTo" jQuery add-on. You'll have to check the validity of that quickly written code.

1
  • I'll do a check and return with an accept
    – bomanden
    Jan 28, 2013 at 20:04
2

You wouldn't be able to do it without JavaScript, unless you link directly to the anchor from the previous page.

<a href="{path='page-with-id'}#id">Page with ID</a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.