3

I'm using the jquery UI to slide a div up on hover. It works fine on its own but I'm having trouble with it working when this <script src="http://www.google.com/jsapi" type="text/javascript"></script> is also installed, (I'm using this to .load some content elsewhere on the page) If I remove either script they work fine, but together the jquery UI stops working.

These are the scripts that I'm using - any idea of the best way around this? Thanks in advance.

<script src="http://www.google.com/jsapi" type="text/javascript"></script>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
3
  • are you loading these in the head, or elsewhere? where are you loading the script that calls jquery ui? what errors are you getting? Commented May 2, 2012 at 14:26
  • Hi, im loading them in the head, the errors im getting are just that on hover the div wont appear, but if i remove <script src="google.com/jsapi" type="text/javascript"></script> it works fine. (but without that the .load wont work). the site in question is new.pudle.co.uk Commented May 2, 2012 at 14:31
  • I haven't looked at the site yet, but you might be making the jQuery UI calls before jQuery UI has finished loading. Loading the Google stuff or not might make the difference in timing. Commented May 2, 2012 at 14:37

1 Answer 1

6

When you use Google jsapi, you must load jquery and jquery UI using the load method only :

    <script type="text/javascript">
      google.load("search", "1");
      google.load("jquery", "1.4.2");
      google.load("jqueryui", "1.7.2");
    </script>

(from https://developers.google.com/loader/ )

That's the whole point : you don't need to include (and serve) the jquery files yourself as you're using Google API (and servers).

Sign up to request clarification or add additional context in comments.

2 Comments

works great, thanks allot ! is it still necessary to provide fallback jquery hosted on my server ?
No. It wouldn't work. And when your problem is only Google server not responding, you're doing very fine ! Don't forget those files are cached by the browser, and as they're used by many sites they're likely to remain in the cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.