[SOLVED] Problem in Chrome . . . $(document).ready

[SOLVED] Problem in Chrome . . . $(document).ready

It took me a while to get all these competing scripts to work together, and then I thought I really should just be using a framework that provides an easy to use function for adding initialization-type routines to the on load stack and running them all successfully. So I thought I'd try jQuery. I've tested it in IE, Firefox, and Chrome. Works in IE and Firefox, but not Chrome.

These are the scripts I'm trying to run
http://www.dyn-web.com/code/scroll/
http://www.shadowbox-js.com/index.html

Here is the page live using $(document).ready: http://www.cityofpeace.com/v3/index.php
Here it is using the other methods i was able to get it to work with in chrome: http://www.cityofpeace.com/v3/index_.php

In my doc head
<script type="text/javascript">
   $(document).ready(function(){
      // Shadowbox initialization
      Shadowbox.init({skipSetup:true,players:["iframe"]});
      
      setupFlash();
      
      loadCart();
      
      init_dw_Scroll();
   });
</script>


In an attached js
function init_dw_Scroll()
{
   var wndo = new dw_scrollObj('cartcontainer', 'sidecart');
   wndo.setUpScrollControls('cartcontrols');
}



In shadowbox.js, the Shadowbox.init function is this. It says it should be called in the Head, and I have gotten it to work that way, but for consistency I want to call everything from $(document).ready if possible.
        /**
         * Initializes the Shadowbox environment. Should be called by the user in
         * the <head> of the HTML document.
         *
         * Note: This function attempts to load all Shadowbox dependencies
         * dynamically. However, if these dependencies are already included on the
         * page they won't be loaded again.
         *
         * @param   Object      opts    (optional) The default options to use
         * @return  void
         * @public
         */
        init: function(opts){
            if(initialized) return; // don't initialize twice
            initialized = true;

            opts = opts || {};
            init_options = opts;

            // apply options
            if(opts)
                apply(S.options, opts);

            // compile regular expressions here for speed
            for(var e in S.options.ext)
                S.regex[e] = new RegExp('\.(' + S.options.ext[e].join('|') + ')\s*$', 'i');

            if(!S.path){
                // determine script path automatically
                var pathre = /(.+\/)shadowbox\.js/i, path;
                each(document.getElementsByTagName('script'), function(s){
                    path = pathre.exec(s.src);
                    if(path){
                        S.path = path[1];
                        return false;
                    }
                });
            }



The only clue I'm getting in the chrome developer tool script console is:
Uncaught TypeError: Cannot call method 'addEvent' of undefined

Can anyone help?
    • Topic Participants

    • info