Archive for myfreeforum.org Before posting please check the "stickies" in the support forums.
Please ask questions in real English and not "txt". You will get a better response.
Please do not ask support questions via PMs.
 



       myfreeforum.org Forum Index -> What's new? Announcements!
admin (no pm's please)

Jquery installed.

http://www.templatelite.com/100-popular-jquery-plugins/

For some examples.

the library is at "js/jquery.js" when you include it.

This is a 55kb file do don't include it lightly!

So what is it all about? Javascript can add quite a lot of features to pages, and jquery can make it easy.

Code:

$(document).ready(function(){
   $("a").click(function(event){
  
     event.preventDefault();
 $(this).hide("slow");

   });
 });


The above example hijacks all links on a page and hide them when you click on them preventing their actual link happening    

Silly, but it does show the $("a") construct that picks out all links, that construct can pick out sets of elements from a page in an extraordinary number of ways:

Code:

$("div > p").css("border", "1px solid gray");


will pick out the child paragraphs of divs using a syntax recognizable to anyone who knows css. It then calls a function that sets the css for those elements, now heres the clever thing, all the jquery functions also return sets of elements, generally the element they were called for. So functions can chain.


Code:

$("div > p").css("border", "1px solid gray").hide("slow");


would then hide those elements (very dumb example).

Given the wide range of jquery functions, you can write short snippets of javascript that do a lot in a very understandable fashion (if you know css/html).

Doing code like collapsing portals would be much shorter and sweeter in Jquery.

As I say though the file is big, but if you want a lot of javascript effects I think this is the way to go, there any plenty of tutorials out there.

       myfreeforum.org Forum Index -> What's new? Announcements!
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum