1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF Javascript libraries

Discussion in 'XenForo Questions and Support' started by Ryan Kent, May 15, 2011.

  1. Ryan Kent

    Ryan Kent Well-Known Member

    I am brand new to using Javascipt. I want to add a simple accordion menu to a wiki page on my XF site. I found a site with some js that works fine for what I need http://jqueryui.com

    I anticipate as I develop I will wind up finding various js libraries with code snippets I desire. It is my understanding the addition of each of these libraries adds a bit to the heaviness of my page loads. Before I start down this path, I wanted to ask if there is a main site that contains a library of js already in use by XF. In other words, some js code like accordions and other things that I can use without loading new libraries of code.
     
  2. James

    James Well-Known Member

    As you probably know, jQuery is already used by XF so you can use jQuery syntax with no worries.
     
  3. Ryan Kent

    Ryan Kent Well-Known Member

    Well, this is where my complete noobness will shine but I have to ask...do I simply go to http://jquery.com/ and try to find code there? If I do, then the code will most likely work without me having to reference another js library or adding a new js library to my web server?

    Also, I noticed the site has v1.6.1. For the most part, would I be able to use the same code with the version XF uses, 1.4.4? I am sure there are some differences, but I am asking is if in most basic coding a noobie will use, is there any important difference?
     
  4. Despair

    Despair Active Member

    Something like an accordion will most likely require a jQuery plugin, which would require you to add more scripts to the page. The accordion menu you were referring to is part of jQuery UI and would require you to include the script on top of jQuery (and possibly a css file if you want it prestyled).

    For the different versions, most plugins list the range of versions they support, but you'll have to carefully test it to be certain.
     

Share This Page