0

我对使用 jquery 库的 Mac 样式菜单有一个大问题。代码如下:

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'/>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js' type='text/javascript'/>

<link href='http://sites.google.com/site/.../style.css' rel='stylesheet' type='text/css'/>
<!--[if lt IE 7]>
<style type="text/css">
.dock img { behavior: url(http://sites.google.com/site/.../iepngfix.htc) }
</script>
</style>
<![endif]-->


<div class="dock" id="dock">
 <div class="dock-container">
 <a class="dock-item" href="#"><img src="images/home.png" alt="home" /><span>Home</span></a> 
<a class="dock-item" href="#"><img src="images/email.png" alt="contact" /><span>Contact</span></a> 
<a class="dock-item" href="#"><img src="images/portfolio.png" alt="portfolio" /><span>Portfolio</span></a> 
<a class="dock-item" href="#"><img src="images/music.png" alt="music" /><span>Music</span></a> 
<a class="dock-item" href="#"><img src="images/video.png" alt="video" /><span>Video</span></a> 
<a class="dock-item" href="#"><img src="images/history.png" alt="history" /><span>History</span></a> 
<a class="dock-item" href="#"><img src="images/calendar.png" alt="calendar" /><span>Calendar</span></a> 
<a class="dock-item" href="#"><img src="images/rss.png" alt="rss" /><span>RSS</span></a> 
</div>
 </div>
 <!--dock menu JS options -->
 <script type="text/javascript">
 $(document).ready(
 function()
 {
 $('#dock').Fisheye(
 {
 maxWidth: 50,
 items: 'a',
 itemsText: 'span',
 container: '.dock-container',
 itemWidth: 40,
 proximity: 90,
 halign : 'center'
 }
 )
 }
 );
 </script>

我还使用带有 jquery 库的幻灯片小工具,并从多个 jquery 实例开始 - 我相信 - 所有问题。我网站的网址:http://www.24-ores.com

问题是我试图用动画菜单栏而不是6个大图标制作一个mac风格的菜单。只是为了更广泛地了解我的代码,这里是幻灯片的代码,它也使用jquery库并试图避免冲突我使用第二个 jquery 1.3.2 库。顺便说一句,该代码可以工作。

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'/>
<script>
    jq131 = jQuery.noConflict(true);
</script>

<script type='text/javascript'>

//<![CDATA[

/* ------------------------------------------------------------------------
s3Slider

Developped By: Boban Karišik -> http://www.serie3.info/
CSS Help: Mészáros Róbert -> http://www.perspectived.com/
Version: 1.0

Copyright: Feel free to redistribute the script/modify it, as
long as you leave my infos at the top.
-------------------------------------------------------------------------- */


(function(jq131){

jq131.fn.s3Slider = function(vars) {

var element = this;
var timeOut = (vars.timeOut != undefined) ? vars.timeOut : 10000;
var current = null;
var timeOutFn = null;
var faderStat = true;
var mOver = false;
var items = jq131("#" + element[0].id + "Content ." + element[0].id + "Image");
var itemsSpan = jq131("#" + element[0].id + "Content ." + element[0].id + "Image span");

items.each(function(i) {

jq131(items[i]).mouseover(function() {
mOver = true;
});

$(items[i]).mouseout(function() {
mOver = false;
fadeElement(true);
});

});

var fadeElement = function(isMouseOut) {
var thisTimeOut = (isMouseOut) ? (timeOut/2) : timeOut;
thisTimeOut = (faderStat) ? 10 : thisTimeOut;
if(items.length > 0) {
timeOutFn = setTimeout(makeSlider, thisTimeOut);
} else {
console.log("Poof..");
}
}

var makeSlider = function() {
current = (current != null) ? current : items[(items.length-1)];
var currNo = jq131.inArray(current, items) + 1
currNo = (currNo == items.length) ? 0 : (currNo - 1);
var newMargin = $(element).width() * currNo;
if(faderStat == true) {
if(!mOver) {
jq131(items[currNo]).fadeIn((timeOut/6), function() {
if($(itemsSpan[currNo]).css('bottom') == 0) {
jq131(itemsSpan[currNo]).slideUp((timeOut/6), function() {
faderStat = false;
current = items[currNo];
if(!mOver) {
fadeElement(false);
}
});
} else {
jq131(itemsSpan[currNo]).slideDown((timeOut/6), function() {
faderStat = false;
current = items[currNo];
if(!mOver) {
fadeElement(false);
}
});
}
});
}
} else {
if(!mOver) {
if($(itemsSpan[currNo]).css('bottom') == 0) {
jq131(itemsSpan[currNo]).slideDown((timeOut/6), function() {
jq131(items[currNo]).fadeOut((timeOut/6), function() {
faderStat = true;
current = items[(currNo+1)];
if(!mOver) {
fadeElement(false);
}
});
});
} else {
jq131(itemsSpan[currNo]).slideUp((timeOut/6), function() {
jq131(items[currNo]).fadeOut((timeOut/6), function() {
faderStat = true;
current = items[(currNo+1)];
if(!mOver) {
fadeElement(false);
}
});
});
}
}
}
}

makeSlider();

};

})(jq131);

//]]>
</script>


<script type='text/javascript'>
jq131(document).ready(function() {
jq131(&#39;#s3slider&#39;).s3Slider({
timeOut: 10000
});
});
</script>

<style type='text/css'>
#s3slider {
background:#000;
border:1px solid #000033;
width: 320px;
height: 230px;
position: relative;
overflow: hidden;
}
#s3sliderContent {
width: 320px;
position: absolute;
top:-1px;
padding: 0px;
margin-left: 0;
}
.s3sliderImage {
float: left;
position: relative;
display: none;
}
.s3sliderImage span {
position: absolute;
left: 0;
font: 17px Trebuchet MS, sans-serif;
padding: 1px 0px;
width: 320px;
background-color: #000;
filter: alpha(opacity=80);
-moz-opacity: 0.8;
-khtml-opacity: 0.8;
opacity: 0.8;
color: #fefefe;
display: none;
bottom: 0;
text-align:center;
}
.clear {
clear: both;
}
</style>

我将不胜感激对我的网站的任何帮助。我的网站的网址带有 6 个大图标而不是一个栏:www.24-ores.com

4

1 回答 1

1

从我访问您的网站时看到的情况来看,“鱼眼”方法不存在。你错过了一部分。

Uncaught TypeError: Object [object Object] has no method 'Fishey' http://www.24-ores.com/:702

Uncaught ReferenceError: cbb is not defined ads:5

Uncaught ReferenceError: cbb is not defined ads:5

加载 jQuery 后,您需要在页面的某处包含鱼眼脚本。从我看到的情况来看,您编写的语法看起来不错。

编辑只是好奇,尝试fisheye而不是Fisheye.

于 2012-07-20T15:32:35.347 回答