Welcome to TalkGraphics.com
Results 1 to 9 of 9

Threaded View

  1. #5
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Creating Links to Layers

    And once again I forgot to remove the logging.
    Also the code was incorrect and inflexible.
    Please use the updated:

    Code:
    <script>
    function openAndScroll(sid){
     var e=document.getElementById(sid);
     if(e){
      var p=e.parentNode;
      while(p&&p.id.indexOf("xr_xp")!=0)p=p.parentNode;
      if(p){
       xr_cpu(parseInt(p.id.substr(5)));
       setTimeout(function(){$('html,body').animate({scrollTop:$(e).offset().top-25},'slow');},100);
      }
     }
    }
    </script>
    As mentioned above, the main part is taken from Acorn's example.
    How it works:

    1. The code at the head creates a function called openAndScroll. (see above)
    2. The object on the pop-up layer has the name 'magic' applied. (This lets Xara give the created HTML element that ID. Any simple name would be allowed.)
    3. The button is linked to
    Code:
    javascript:openAndScroll('magic');
    which calls the function passing the parameter 'magic'.
    4. The button has the name 'UsesJQuery' applied to tell Xara to include the JQuery javascript library.
    5. There is a rectangle below the button that forces the pop-up layer to be exported.

    When the button is clicked the function tries to find the HTML element with the given ID.
    If found it tries to identify the internal number of the pop-up layer.
    If found it calls the Xara internal function to open the pop-up layer and calls Acorns code a little delayed.
    Attached Files Attached Files

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •