sam
sam

Reputation: 10074

jquery ui wont work while the "http://www.google.com/jsapi" script is also linked

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>

Upvotes: 3

Views: 5982

Answers (1)

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382150

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).

Upvotes: 6

Related Questions