...

View Full Version : Jquery and Prototype conflict: Please help!



novella
09-01-2010, 12:22 AM
I have no idea about javascript coding usually just follow tutorials but i cant find any:
I am having a jquery and prototype conflict



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/prototype/1.6.1/prototype.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js'></script>
<script type='text/javascript' src='/lightview.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script type="text/javascript" src="/photography/js/scrollable.js"></script>
<script>
jQuery.noConflict();

// Use jQuery via jQuery(...)
jQuery(document).ready(function(){
jQuery("div.scrollable").hide();
});

// Use Prototype with $(...), etc.
$('div.box').hide();
</script>


<link rel="stylesheet" type="text/css" href="/lightview.css" />
<link rel="stylesheet" href="/photo.css" type="text/css" media="screen" charset="utf-8" />


<title>untitled</title>

</head>

<body>
<div id="wrapped">
<div id="centered">
<div id="slideshow">
<a class="prev browse left"></a>
<a class="next browse right"></a>
<div class="scrollable">
<div class="items" id="response">
<div class="box col1 ">
<a href='image.jpg' class='lightview'>My image</a></div>
<div class="box col1 ">
<a href='/photography/photos/china1.jpg' class='lightview'>China 1</a></div>

</div></div>
</div></div></div><!--slideshow-->

<script>
$(document).ready(function() {});

$("div.scrollable").scrollable({
keyboardSteps: 1,
clickable: true,
keyboard: 'static',
size: 1,
loop: true,
});
</script>

</body>
</html>


Any help?

novella
09-01-2010, 10:17 PM
Anyone?

Spudhead
09-02-2010, 10:18 AM
I don't think you're using noConflict() correctly.

Have a look at the example code in the docs (http://api.jquery.com/jQuery.noConflict/).

Also, I'm not sure what that bit down the bottom is supposed to be doing but you can't use jQuery's


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

if you've just assigned $ to prototype.

novella
09-02-2010, 01:19 PM
I don't think you're using noConflict() correctly.

Have a look at the example code in the docs (http://api.jquery.com/jQuery.noConflict/).

Also, I'm not sure what that bit down the bottom is supposed to be doing but you can't use jQuery's


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

if you've just assigned $ to prototype.


Ah okay thanks, i read thr noConflict document, but as I said I really don't have any knowledge of javascript so it isn't making much sense to me.

rnd me
09-02-2010, 11:11 PM
if just jQuery, jQuery===$...

thus:


jQuery(document).ready(function() {});



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum