Use jquery in page

edited February 2012 in Installation
Hello!
I have a problem with my first FuelCMS Page. I want to use some jquery stuff on my new page. I have added the following lines in my header file:
{js('jquery')}
{js('fancybox/jquery.easing-1.3.pack')}
{js('fancybox/jquery.mousewheel-3.0.4.pack')}
{js('fancybox/jquery.fancybox-1.3.4')}

I verified that this links are working. But my jquery functions won't execute and I don't see why.
Can you please help me out?

Thanks in advance

Comments

  • edited 1:02AM
    You have the above in an editable cms page?

    Can you post your jQuery functions?

    Try placing {literal}{/literal} around them. I've found that if the js has regex in there it still fails, best to put the code in /assets/js/main.js
  • edited 1:02AM
    Thanks for your answer!
    It's an editable cms page.
    I've tried the solution with the literal tags, but it doesn't work.
    I want to implement the Fancybox jquery Plugin, which can be found here: http://fancybox.net/

    Here is my jquery code (with the html part and the literal tags):

    {literal}
    $(document).ready(function() {
    $("a#gallery").fancybox();
    });
    {/literal}
  • edited 1:02AM
    Do they execute OK if you are logged out of the CMS and just viewing the page?
  • edited 1:02AM
    Thank you for your answer!
    It finally works! I've putted my jquery code into the assets/js/main.js file and placed the following lines into my header:

    {* Scripts *}
    {js('jquery')}
    {js('main')}
    {js('fancybox/jquery.easing-1.3.pack')}
    {js('fancybox/jquery.mousewheel-3.0.4.pack')}
    {js('fancybox/jquery.fancybox-1.3.4')}

    Now everything works as expected!
    Thank you all very much for your help!
Sign In or Register to comment.