Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-19-2008, 08:03 PM   PM User | #1
Isoparm
New to the CF scene

 
Join Date: Jul 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Isoparm is an unknown quantity at this point
jQuery Prototype conflict

Hi, I've been trying to get the jQuery galleria plugin to co-exist with a prototype plugin, but can't get it to work. I can get one or the other, but not both. If anyone could tell me what/how the code needs to be changed I would be really, really appreciative. (Seems like it is an issue with the $ variable, but I don't know what to change) The code is:

<head>
<script type="text/javascript" src="/js/prototype.js""></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.galleria.js"></script>
<link href="/css/galleria.css" rel="stylesheet" type="text/css" media="screen">

<script type="text/javascript">
jQuery(function($) {
$('.gallery_demo_unstyled').addClass('gallery_demo');
$('.nav').css('display','none'); // hides the nav initially

$('ul.gallery_demo').galleria({
history : false,
clickNext : false,
insert : undefined,
onImage : function() { $('.nav').css('display','block'); }
});
});
</script>

<script type="text/javascript">
defaultId = 'a';

// sliders, drawers
var freeDrawers = function(container) {
return function() {
if (!AC.Detector.isIEStrict()) {
$(container).setStyle({height: 'auto'});
}
}
}

var createSlider = function(container, drawers, triggerEvent) {
var sliders = new AC.SlidingBureau($(container));
for (var d = 0; d < drawers.length; d++) {
var handle = drawers[d].getElementsByClassName('drawer-handle')[0];
var content = drawers[d].getElementsByClassName('drawer-content')[0];
var drawer = new AC.SlidingDrawer(content, handle, sliders, {
triggerEvent: 'mouseover',
triggerDelay: 120});
sliders.addDrawer(drawer);

var title = 'Window Shade - ' + drawer.handle.innerHTML;
var properties = {sprop3: title};
AC.Tracking.trackLinksWithin(content, function() {return true;} , title, properties);
}
setTimeout(freeDrawers(container), 1000);

return sliders;
}

Event.observe(window, 'load', function() {
var triggerEvent = 'mouseover';
createSlider('leftdrawers', $$("#leftdrawers .drawers>li"), triggerEvent);
});

</script>

</head>
Isoparm is offline   Reply With Quote
Old 07-19-2008, 09:43 PM   PM User | #2
NancyJ
Senior Coder

 
NancyJ's Avatar
 
Join Date: Feb 2005
Location: Bradford, UK
Posts: 3,162
Thanks: 19
Thanked 65 Times in 64 Posts
NancyJ will become famous soon enough
the jquery calls needs to use jquery instead of $ - which is overwritten by prototype but IMHO you'd be better finding/writing a jquery plugin to replace the prototype.
__________________
http://www.hazelryan.co.uk
NancyJ is offline   Reply With Quote
Old 07-19-2008, 10:02 PM   PM User | #3
Isoparm
New to the CF scene

 
Join Date: Jul 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Isoparm is an unknown quantity at this point
So would I do something like this:

CHANGE:
$('.gallery_demo_unstyled').addClass('gallery_demo');

TO:
jQuery('.gallery_demo_unstyled').addClass('gallery_demo');


Would I also need to replace every instance of $ in the jquery.galleria.js, and jquery.js files?
Isoparm is offline   Reply With Quote
Old 07-20-2008, 12:41 PM   PM User | #4
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
I think you should read this: http://docs.jquery.com/Using_jQuery_...ther_Libraries

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:37 PM.


Advertisement
Log in to turn off these ads.