I couldn't get this working with drupal_add_js().

I put the necessary javascript into the views-galleriffic-view.tpl.php file which does not seem like a good practice.

I left the drupal_add_js function in views-galleriffic.module so it is still actually loading.

I don't know how to add the additional info at the top of the javascript:

		// We only want these styles applied when javascript is enabled
			$('div.navigation').css({'width' : '300px', 'float' : 'left'});
			$('div.content').css('display', 'block');

			// Initially set opacity on thumbs and add
			// additional styling for hover effect on thumbs
			var onMouseOutOpacity = 0.67;
			$('#thumbs ul.thumbs li').css('opacity', onMouseOutOpacity)
				.hover(
					function () {
						$(this).not('.selected').fadeTo('fast', 1.0);
					}, 
					function () {
						$(this).not('.selected').fadeTo('fast', onMouseOutOpacity);
					}
				);

			$(document).ready(function() {
				// Initialize Advanced Galleriffic Gallery
				var galleryAdv = $('#gallery').galleriffic('#thumbs', {

which is where I think I got hung up.

Comments

scroogie’s picture

What do you mean with additional info? I think you should actually put this code in a seperate file (say views_galleriffic.js) and add it with

 drupal_add_js(drupal_get_path('module', 'views_galleriffic').'/views_galleriffic.js');
acouch’s picture

That makes sense. The variables from the views settings then could be added to that file. I will give it a shot.

scroogie’s picture

You might also want to have a look at Drupal.settings to store your settings, because then you can easily set these settings in PHP, e.g. with a value retrieved by variable_get, so you can later on expose it in a settings page.

Also, instead of using

$(document).ready(function() { }

you should use

Drupal.behaviors.viewsGallerifix = function (context) { }

See http://drupal.org/node/205296 for the reason.

acouch’s picture

Thanks. This is helpful. I'll probably give it a shot in the next couple of days.

acouch’s picture

Status: Active » Closed (fixed)

A couple of days turned into a couple of months but this has been fixed.