views:

145

answers:

3

Hi everybody!

I'm continuously having the problem when i use jquery lightbox (which runs prototype) and jquery news slider.

I tried the "noconflict" method.

The problem is I don't know the exact place to put the code.

So, here, i'm putting my scripts within .

So, please troubleshoot it and explain me where to put the patch.

thank you very much.

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>Jquery</title> 

<script type="text/javascript" src="lb/js/prototype.js"></script>
<script type="text/javascript" src="lb/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="lb/js/lightbox.js"></script>
<link href="lb/css/lightbox.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="news/jquery-1.2.3.pack.js"></script>
<script type="text/javascript" src="news/jquery.easynews.js"></script>



<style>
html
{ background-color: #FFA928;
font: normal 76% "Arial", "Lucida Grande",Verdana,  Sans-Serif;
 color:black;
 }
a { text-decoration: none; font-weight: bold; }

.news_style{
display:none;
}
.news_show
{
background-color: white;
color:black;
width:350px;
height:150px;
font: normal 100% "Arial", "Lucida Grande",Verdana,  Sans-Serif;
overflow: auto; 

}
.news_border
{
background-color: white;
width:350px;
height:150px;
font: normal 100% "Arial", "Lucida Grande",Verdana,  Sans-Serif;
border: 1px solid gray;
padding: 5px 5px 5px 5px;
overflow: auto; 

}
.news_mark{
background-color:white ;
font: normal 70% "Arial", "Lucida Grande",Verdana,  Sans-Serif;
border: 0px solid gray;
width:361px;
height:35px;
color:black;
text-align:center;
}
.news_title{
font: bold 120% "Arial", "Lucida Grande",Verdana,  Sans-Serif;
border: 0px solid gray;
padding: 5px 0px 9px 5px;
color:black;
}
.news_show img{

margin-left: 5px;
margin-right: 5px;

}
.buttondiv
{
position: absolute;
/*float: left;*/
/*top: 169px;*/
padding: 5px 5px 5px 5px;
background-color:white ;
border: 1px solid gray;
/*border-top-color: white;*/
border-top:none;
height:20px;
}

</style>
<script>
$(document).ready(function(){
var newsoption1 = {
  firstname: "mynews",
  secondname: "showhere",
  thirdname:"news_display",
  fourthname:"news_button",
   newsspeed:'6000'
}
$.init_news(newsoption1);


var myoffset=$('#news_button').offset();

var mytop=myoffset.top-1;

$('#news_button').css({top:mytop});

});
</script>

</head>
A: 

Eh? jQuery lightbox doesn't use prototype. What exactly are you using?

Try this http://leandrovieira.com/projects/jquery/lightbox/

And dump prototype all together if you can. Better to avoid two bulky frameworks.

Mark
thank you mark. I'm a newbie.
xenogen
+1  A: 

I don't know how much clearer you can get then the explanation here

In essence, calling jQuery.noConflict relinquishes the $ variable to whatever it was defined as before you loaded jQuery.

After that you need to call jQuery to use it directly. In my case I redefine it like so:

$j = jQuery; // Now I can use $j for jQuery and $ for Prototype

You can also use the $ inside a ready function, like so:

jQuery(document).ready(function($) {
  // Code that uses jQuery's $ can follow here.
});

Pretty straightforward... what are you confused about?

dasil003
thanks buddy! actually i'm a newbie and i'm just building my website with the help of guyz like you. thanks again.
xenogen
A: 

Put the $.noConflict() call immediately after you include the jquery lib. See here.

<script type="text/javascript" src="news/jquery-1.2.3.pack.js"></script>
<script type="text/javascript">
  $.noConflict();
  // Code that uses other library's $ can follow here.
</script>
Dane