我正在尝试jquery tool tip打开mootools lightbox中的链接。
你能帮帮我吗......这是我的代码:
标题
<!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">
<script language="javascript" type="text/javascript" src="js/bumpbox.js"></script>
<script src="js/sifr.js" type="text/javascript"></script>
<script src="js/sifr-config.js" type="text/javascript"></script>
<script src="http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js" type="text/javascript"/></script>
<script type="text/javascript">
//no conflict jquery
var $ = jQuery.noConflict();
//jquery stuff
</script>
<script language="javascript" type="text/javascript" src="js/mootools.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen,projection" />
<head>
现在这是我的身体代码:
<p>Phasellus pulvinar lacinia sapien eu lacinia. Sed fermentum augue et lectus ullamcorper quis cursus justo venenatis. Aenean id molestie leo. Vivamus ultrices lobortis velit, quis euismod neque aliquet quis. Aliquam et nisi nibh. Ut dolor dui, volutpat id molestie ut, tristique ut tellus. Nunc ut risus sed magna dictum porttitor.</p>
<!-- trigger element. a regular workable link -->
<div id="webdude">
<a id="laurence" title="asdadasd">asdadasd</a> <!-- tooltip element -->
<div class="tooltip" id="small">
<div><span class="name">asdadasd</span><br />
asdadasd <span><a href="^myDIV" class="bumpbox" rel="480-480" title="inline Content">[+]</a></span></div>
</div>
</div>
</div>
<div id="myDIV">
<div class="clear"></div>
<span>Inline content</span>
<p>This is some inline content which is <span class="style1">hidden onload, and then displayed in the bumpbox accordingly</span></p>
<p>Simply give your inline content an ID, fill it with content. Reference the hidden content by using the bumpbox, assigning the href tag with a "^". </p>
<p>For example, this content's DIV ID is "myDIV" and the bumpbox link href has the content href="^myDIV". That's it.</p>
</div>
这是我的页脚:
<script>
// What is $(document).ready ? See: http://flowplayer.org/tools/using.html#document_ready
$(document).ready(function() {
// enable tooltip for "download" element. use the "slide" effect
$("#laurence").tooltip({
effect: 'slide',
offset: [60, 40] });
});
</script>
答案 0 :(得分:5)
通过将jquery重新分配给noConflict
var来破坏$
概念。
使用jQuery.noConflict();
而不分配变量,然后使用jQuery
代替$
所以改变
<script type="text/javascript">
//no conflict jquery
var $ = jQuery.noConflict();
//jquery stuff
</script>
到
<script type="text/javascript">
//no conflict jquery
jQuery.noConflict();
//jquery stuff
</script>
和
$(document).ready(function() {
// enable tooltip for "download" element. use the "slide" effect
$("#laurence").tooltip({
effect: 'slide',
offset: [60, 40] });
});
到
jQuery(document).ready(function() {
// enable tooltip for "download" element. use the "slide" effect
jQuery("#laurence").tooltip({
effect: 'slide',
offset: [60, 40] });
});
答案 1 :(得分:2)
如果你像这样包装jQuery,你就不会改变你的代码。 $ scope将与其余代码隔离,不会与其他js框架发生任何冲突。
(jQuery.noConflict())(function($) {
// enable tooltip for "download" element. use the "slide" effect
$("#laurence").tooltip({
effect: 'slide',
offset: [60, 40]
});