Remotely Hosted? No Problem

Posted on April 21, 2008

There are alot of remotely hosted systems out nowadays, Zetaboards, SMF for Free and the series of IPB 1.3.1s. If you want to edit the looks of your board you need to use Javascript since you can’t access the source PHP files. You can work your way around using getElementById and the likes, or you can use jQuery. Here are some hints on how to use it.

Say you have a menu and you want to add some extra items to it. The menu code is something like..


We want to add another

  • Item Six
  • beneath the element

    
    

    So, in normal javascript you would need to find the unordered list with an id of navlist, then add innerHTML or a childnode of the ordered list. However in jQuery we can do this with one easy line.

     $("#navlist").append("
    
  • A Custom item
  • ");

    That would add it to the start of the list, if we wanted it at the end we would use the prepend function.

     $("#navlist").prepend("
    
  • A Custom item
  • ");

    What if there were a menu item we didn’t like? Say Item Four. Lets get ride of it! We could need to match the text inside the list, then hide it. With this next snippet, we are using the selector contains and are looking for the word four in every single ordered list ( li )

     $("li:contains('four')").hide();

    For some strange reason, if you wanted to make the list items fade out instead of just being hidden, its not hard to change it (Because of jQuery’s chainability). Instead of hide() -ing. Just fade out like so.

     $("li:contains('four')").fadeOut("slow");

    If theres something you want to do with your remotely hosted system, but don’t know how. Feel free to ask!

    Tags:

    Leave a Reply

    You must be logged in to post a comment.


    Loading ...