We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4424
    • 42 Posts
    Hey all,

    I was wondering if you could help me out?

    On my site I wanted to use the coda slider on multiple pages.
    It’s an AJAX tabs script which looks fancy.
    Now the problem:

    The script links to yoursite.com/page.html#3 (the #3 is the third tab on that page )
    Now, the linking is done in the javascript:

    						jQuery("div#stripNav" + j + " ul").append("<li class='tab" + (n+1) + "'><a href='#" + (n+1) + "'>" + jQuery(this).attr("title") + "<\/a><\/li>");												
    


    As you see, it links to that page and puts a number behind the URL..
    Now, I have multiple pages that have different urls ( yoursite.com/info/books.html#3 and yoursite.com/info/tv.html#3 )
    And because Modx has the base href everything links to yoursite.com/#3 which isn’t good.

    Now I’ve already did this:
    <a href=info/'#" + (n+1) + "'>


    But that just links to yoursite.com/info/#3

    My question is:

    Is it possible to use the [*alias*] parameter in that javascript and if possible how do I do that?
    I’ve read that’s it’s possible to have javascript chunks but all examples were made in combination with snippets..

    If not possible does anyone has an idea how I can use this tab still?

    Thanks in advance!

    Brandon



      • 4424
      • 42 Posts
      so in short:

      first i have to install that plugin
      then make all the javascript chunks and use the [+id+] with it

      how do i add the chunks in the <head> with modx?
        • 16867
        • 10 Posts
        You’ll insert the chunk (like so: [tt]{{your.chunk.name}}[/tt] ) in the template. All the templates are at Resources > Manage Resources > Templates.

        You can find out which template your pages are using by editing them and looking at the Uses template list.

        Depending on how your templates are set up (with, say, lots of includes or chunks), you may need to do some digging to find where you can actually edit the <head> tags.

        Because this is jQuery code, make sure

        • Your code is in <script> tags (obvious I know)
        • You place your code chunk AFTER the jQuery library and plugins in the <head> tag
          • 4424
          • 42 Posts
          Thanks all grin
          It worked after your tips and I learned some stuff about Modx again, couldn’t ask for me wink