Embed a game

Embedding a game your page is very simple thanks to the Jocly JQuery plugin.

First copy the last version of these 2 files to your server (or local machine) from the GitHub project repository (you can directly right click + save as):
 * jquery.jocly.min.js minified plugin
 * jquery.jocly.min.css minified plugin css

The static way
In the   section of your page include the following lines:   

In the body of your page, just insert this line of code:



Et voilà!

Reload your page, you should see the game loading.

In this case we have chosen classic-chess, this is the machine name of the game.

Machine name of available games can be found in Jocly code inspector. Select the game you want to embed, the first displayed info field will be the Game machine name.

Example of complete page including a chess game:

<!doctype html>  Playing Chess    

The dynamic way (recommended)
If you want to have more control on your embedded widget, we recommend to use the dynamic script way:

In the   section of your page insert the same lines   

In the   of your page insert a &lt;div&gt; called for instance jocly-applet where you want to place your game:

Then go back to   section to add a script that will dynamically populate this div when the page is ready (completely loaded): $(document).ready(function {   $("#jocly-applet").jocly.jocly("localPlay","classic-chess"); });

And that's it. At this point your game should show up in your page.

It's now easy to play with all the options and methods of the plugin

Complete page example <!doctype html>  Playing Chess    $(document).ready(function {   $("#jocly-applet").jocly.jocly("localPlay","classic-chess"); });