Need some Javascript Knowledge

Events happening in the community are now at Drupal community events on www.drupal.org.
Summitt Dweller's picture

Greetings all.

I have what I believe to be a javascript issue, but since I know very little about javascript I can't be sure. Help!

A client (non-profit) of mine purchased a very inexpensive calendar widget recently and asked me to add it to their website. I copied the code into a block and placed the block where desired on their home page...it worked very nicely. Only problem is it "broke" all the other javascript on that page, so things like Views Slideshow animations stopped working.

Can anybody tell me, in 100 words or less, if I can fix this and how I might do so?

The widget code starts like this:

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

<script type='text/javascript'>$(document).ready(function(){var...

Thanks all, and Happy Holidays!

Mark

Comments

Some good resources

ontological's picture

Hi Mark,

My experience is with D7, in case you are using 7... jQuery is already included in D7, so your first two lines may not be needed:

I found these threads helpful when creating a jQuery slide show. This one is on adding a jQuery plugin:
http://drupal.org/node/1043478

And this one on managing JavaScipt in D7:
http://drupal.org/node/756722

This one is an API link:
http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ad...

So, for your last line you might try something like this (from the 3rd link above) inside of PHP tags:

drupal_add_js('jQuery(document).ready(function () { var... });', 'inline');

Hope this helps,

David

noConflict

heddn's picture

If the calendar widget is not using jquery, or uses a different version than what comes with Drupal, then try checking into http://api.jquery.com/jQuery.noConflict/

Lucas

Thanks David and Lucas

Summitt Dweller's picture

Thanks for the info gentlemen. I'll check the resources and advice you provided when I can. Just FYI... This site is using D6, I have jQuery enabled there, and I do believe this may be an issue with the widget using a different jQuery version.

Thanks again.

Mark

Mark

noConflict Did the Trick

Summitt Dweller's picture

Thanks again gentlemen. Adding the noConflict call did the trick!

Mark

Central Iowa Drupal Users Group

Group categories

Category

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: