views:

17

answers:

1

How to use Jquery libraries or how to use fancy box using JQuery.

+1  A: 

Generally speaking...

Most jQuery plugins are used merely by referencing the plugin source file after the jQuery source, and then calling the plugin method on a selector:

$("a.something").plugin();

This will vary from plugin to plugin, so be sure to consult the relevant documentation. Some plugins will accept arguments in JSON form:

$("a.something").plugin({ 'foo':'bar', 'fizz':'buzz' });

Again, consult the relevant documentation.

Fancybox, specifically...

You can find the fancybox documentation online at http://fancybox.net/howto where they give great details about how to implement it in your project. They finish off their how-to with the following example:

$(document).ready(function() {

  /* This is basic - uses default settings */
  $("a#single_image").fancybox();

  /* Using custom settings */
  $("a#inline").fancybox({ 'hideOnContentClick':true });

  $("a.group").fancybox({ 'speedIn':600, 'speedOut':200, 'overlayShow':false });

});

Note the similarities between this, and the aforementioned general rules.

Jonathan Sampson