Results 1 to 1 of 1

Article: I get jQuery errors on Seyret...

  1. I get jQuery errors on Seyret...

    0 Comments by admin Published on 13th May 2010 12:30
    If some javascript based tools are not working on your site, it is time to use Firefox and Firebug. For a web developer, these two tools are almost vital to avoid javascript and other errors.
    First, lets summarize how to use them. Install Firefox. You know where to get it. Then go to https://addons.mozilla.org/en-US/firefox/addon/1843/ addon page. Install the extension and restart Firefox. Now, at the right bottom of Firefox window, you'll see a gray bug icon. Click it and you'll see a panel. Also that icon will turn into colored state. Right click that icon and enable all panels.
    Then go to your web page. After the render process of your page is finished, you'll see that Firebug has analyzed everything about your web page: Javascript errors, DOM, CSS, HTML, net connections etc. If your page has some javascript based errors, those errors will be listed in Console tab. If you are getting a jQuery.seyrettools is undefined error on that console, please read the following instructions.
    A common problem with javascript libraries is conflicts. Conflicts with other libraries or conflict with other jQuery instances. We need to understand the nature of the second problem.
    The plugin structure is a bit different on jQuery. Now lets see the html source of the main page of your web page. Step by step let us tell what is happening.
    Code:
    
    
    On the first line, the core of jQuery is loaded. On line 2,3,4,5 jQuery plugins are loaded. With a bad choice -in my opinion, maybe wrong-, these plugins are directly added to global jQuery variable. For example the cookie plugin is JQuery.cookie etc... On line 6, mootools is loaded. As we are using noconflict solution, no problems with Joomla.

    Now, the worst line: Line 7. A plugin or a module (for example related to com_anothercomponent) is loading the jQuery file again. jQuery is created again from scratch. All loaded plugins are wiped. Now we have a fresh jQuery. This is the problem.

    We have understood the nature of the problem. So, how can we solve this problem? We need to edit the source code of the second jQuery file. Connect your site via an FTP client, download the jQuery.js from components/com_anothercomponent/assets/jquery.js to your computer. Open it with a text file and wrap whole jQuery code with following code.


    Code:
    if ('undefined'==typeof(jQuery)){
    
     JQUERY FRAMEWORK SHOULD BE PLACED HERE...
    
      jQuery.noConflict();
    }
    Save and upload it to your site. This code snippet will check the jQuery instance. If it is loaded once, it will not load again. Go to your Seyret page, refresh the browser and you'll see that problem is gone.
    Last edited by admin; 27th June 2010 at 01:33.

  2. Total Comments 0

    Comments

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •