0

There it is http://www.parcodesign.com.br, a magento e-commerce. On the footer links, like "Sobre", or "Onde Comprar", "FAQ", "Ajuda", "Informações de Entrega", any of these, when clicked, it triggers a javascript function. This one:

function abreInfo(id) {
  jQuery("#infoShow").slideDown('fast', function () {
    jQuery('html,body').animate({ scrollTop: jQuery("#infoShow").offset().top -120 }, 200);
      jQuery("#infoShow>section").load("info/" + id + ".phtml", function () {
    });
  });
}

The id is taken from each link. It is working fine to show the content, but what I'm searching and trying to do now is to generate a exclusive URL for each of these links. In a way that when the link is clicked, it generates a new URL on the browsers URL box, and than making it able to be copied and accessed from a direct link. Unfortunately, for what I've already searched, no highlights for solutions.

Hope someone can help.

1 Answer 1

1

You will need to change the hyperlinks to have an anchor tag.

<a href="#sobre" onclick="return javascript:abreInfo('sobre');">Sobre a Parco</a>

This will allow you to have hyperlinks like http://www.parcodesign.com.br/#sobre

Then you will need to have a javascript function which picks up the #tag and handles accordingly. Something like the following;

<script type="text/javascript">
      document.observe('dom:loaded', function() {
           var hash = window.location.hash.substring(1);
           if(hash != '') {
                abreInfo(hash);
           }

      });
</script>

Why don't you create new pages for this content though and just have a normal link to the content. Users without javascript cannot access this content nor can a search engine with your current ajax based implementation.

Sign up to request clarification or add additional context in comments.

1 Comment

Ashley, this is it! Just PERFECT! Thanks for the precautions comments too, I will take those to think about.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.