ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

jQuery jCarousel call getting mangled

November 30, 2010 2:57pm

Subscribe [4]
  • #1 / Nov 30, 2010 2:57pm

    jrattinger

    13 posts

    I’m having trouble trying to use the jQuery - jCarousel widget. i have had this working for 6 months without any problems. i just moved my site live and now a problem has cropped up. The problem can be seen on either of these pages (the first one is a bit stripped down for debugging) - http://www.redyref.com/kiosks/custom_kiosks, http://www.redyref.com/touchscreen_building_directories/Office. the carousel should appear above the text “Install Views”.

    It looks like the jQuery libraries are found, but I’m not sure. I am using the expression engine CMS software for this site.

    When refreshing the page, i get a javascript syntax error on the code below. i have posted both the source code and the “View Source” code. if you look closely, you will see that the information for the parameter “itemLoadCallback:” is missing from the “view source” code. So it looks like the callback is being stripped out somehow and then causing a syntax error.

    ORIGINAL CODE:

    [removed]
    
    jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
         vertical: true,
             size: mycarousel_itemList.length,
         itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
        });
    });
    
    [removed]

    VIEW SOURCE CODE:

    [removed]
    
    jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
        vertical: true,
        size: mycarousel_itemList.length,
        itemLoadCallback: 
        });
    });
    [removed]

    The problem is even exists when i copy the code from the author of jcarousel’s code into my site.

    This is the new page.
    http://www.redyref.com/index.php/carousel_test/

    This is the authors page:
    http://sorgalla.com/projects/jcarousel/examples/dynamic_javascript.html

    Any help would be greatly appreciated.

    Thanks,
    John

  • #2 / Dec 01, 2010 1:58am

    John Henry Donovan

    12339 posts

    John ,

    Try adding a line-break before and after onBeforeAnimation: mycarousel_itemLoadCallback

    itemLoadCallback: {
    onBeforeAnimation: mycarousel_itemLoadCallback
    }
  • #3 / Dec 01, 2010 3:02pm

    jrattinger

    13 posts

    Hi John,

    Thanks for your reply, but it didn’t help. Something very strange is going on and i can’t figure it out. After going back and forth for 2 days now, i decided to take the authors code and move it into a test page on my site, get that working and then work backwards. Then only problem is that i can even get the authors code to work.

    The test URL is http://www.redyref.com/index.php/carousel_test_2/ . All that has changed here is that i have changed the authors relative paths to his css and jQuery libraries and put the javascript in a separate file. it doesn’t look like the javascript is still getting stomped on, but it also doesn’t look like the callback function is getting called to create the jcarousel.

    I have no idea why this isn’t working. It feels like something in EE is corrupting my code, but a don’t know. I’m at my whits end with this, HELP!

    Thanks,
    John

  • #4 / Dec 02, 2010 9:16am

    Sue Crocker

    26054 posts

    Hi, John. What I did was go to the author’s site, grab his code, replace the paths he had with exact paths, and it worked just fine.

    NOTE: This is a pretty vanilla install.

    http://test-ee.com/index.php/dectest/jquery

    So how do we differ when it comes to EE? Which build/version of EE2.x are you using? You can find that at the bottom of any control panel page in the footer. (Not in the Info Accessory.)

    What about third party add-ons?

  • #5 / Dec 02, 2010 10:48am

    jrattinger

    13 posts

    Hi Sue, thanks for your help.

    I’m actually starting to sort the problem out now.

    I’m using version 1.67 on this site. i have a few of jQuery add-ons that I’m using and it looks like there were some clashes with different versions of the jQuery library, coupled with out of sequence definitions. Also, some of the javascript that was getting stomped on was in-line. When i moved it to an external file, the stomping went away.

    i don’t know why i couldn’t re-create the carousel page…

    I’m not sure why this all came to light when i moved the site live, but i’m just relieved that an end is in sight.

    thanks again for your input.

  • #6 / Dec 03, 2010 3:03am

    John Henry Donovan

    12339 posts

    jrattinger,

    Glad you have found a troubleshooting route. I’ll keep this open a while longer for you to confirm you are all ok.

  • #7 / Dec 03, 2010 10:02am

    jrattinger

    13 posts

    you can close it, I’m all set.

    thanks everyone for your help!

  • #8 / Dec 03, 2010 10:22am

    Ingmar

    29245 posts

    Very glad to hear it. Post again as needed, please.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases