取消某个页面的功能
我已经编写了这个函数,它是一个水平手风琴,到目前为止它运行良好,我已将其添加到外部js文件中,并将其加载到每个页面中,我现在要做的是在主页上,删除悬停功能,并将颜色设置为#CCC
。我已经尝试了一切,打开 a,添加另一个宽度相同的悬停...
http:// /uwptestsite.uwpistol.net/menu.html
这里是测试页面。
我写的代码在这里。
// JavaScript Document
$(document).ready(function(){
$(".letter-b").width(12);
$(".letter-b").css({"overflow":"hidden", "position":"relative"});
$(".letter-b a").hover(
function() {
$(this).parent().stop().animate({"width": "52"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-e").width(12);
$(".letter-e").css({"overflow":"hidden", "position":"relative"});
$(".letter-e a").hover(
function() {
$(this).parent().stop().animate({"width": "83"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-h").width(12);
$(".letter-h").css({"overflow":"hidden", "position":"relative"});
$(".letter-h a").hover(
function() {
$(this).parent().stop().animate({"width": "53"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-l").width(11);
$(".letter-l").css({"overflow":"hidden", "position":"relative"});
$(".letter-l a").hover(
function() {
$(this).parent().stop().animate({"width": "54"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "11"}, 300);
});
$(".letter-n").width(12);
$(".letter-n").css({"overflow":"hidden", "position":"relative"});
$(".letter-n a").hover(
function() {
$(this).parent().stop().animate({"width": "43"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-o").width(12);
$(".letter-o").css({"overflow":"hidden", "position":"relative"});
$(".letter-o a").hover(
function() {
$(this).parent().stop().animate({"width": "94"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-r").width(12);
$(".letter-r").css({"overflow":"hidden", "position":"relative"});
$(".letter-r a").hover(
function() {
$(this).parent().stop().animate({"width": "95"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-w").width(17);
$(".letter-w").css({"overflow":"hidden", "position":"relative"});
$(".letter-w a").hover(
function() {
$(this).parent().stop().animate({"width": "95"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "17"}, 300);
});
$(".letter-x").width(12);
$(".letter-x").css({"overflow":"hidden", "position":"relative"});
$(".letter-x a").hover(
function() {
$(this).parent().stop().animate({"width": "52"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-y").width(12);
$(".letter-y").css({"overflow":"hidden", "position":"relative"});
$(".letter-y a").hover(
function() {
$(this).parent().stop().animate({"width": "52"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
});
我真的很挣扎,我想我需要一个禁用选项,但这将使它成为一个插件,我不知道该怎么做..而且我不希望每个页面都有启用的链接项目的列表,因为它此刻正在增长,所以如果我能做一些像
$("letter-h").disableAccordion();
我希望我有意义的事情,我知道有人会有解决方案,谢谢!
I've written this function that is a horizontal accordion, So far it's working well, I've added it to an external js file, and loaded it into each page, what i want to do now is on the home page, remove the hover function, and set the colour to #CCC
. I've tried everything, unwrap the a, add another hover with the width the same....
http://uwptestsite.uwpistol.net/menu.html
here is the test page.
my code I have written is here.
// JavaScript Document
$(document).ready(function(){
$(".letter-b").width(12);
$(".letter-b").css({"overflow":"hidden", "position":"relative"});
$(".letter-b a").hover(
function() {
$(this).parent().stop().animate({"width": "52"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-e").width(12);
$(".letter-e").css({"overflow":"hidden", "position":"relative"});
$(".letter-e a").hover(
function() {
$(this).parent().stop().animate({"width": "83"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-h").width(12);
$(".letter-h").css({"overflow":"hidden", "position":"relative"});
$(".letter-h a").hover(
function() {
$(this).parent().stop().animate({"width": "53"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-l").width(11);
$(".letter-l").css({"overflow":"hidden", "position":"relative"});
$(".letter-l a").hover(
function() {
$(this).parent().stop().animate({"width": "54"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "11"}, 300);
});
$(".letter-n").width(12);
$(".letter-n").css({"overflow":"hidden", "position":"relative"});
$(".letter-n a").hover(
function() {
$(this).parent().stop().animate({"width": "43"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-o").width(12);
$(".letter-o").css({"overflow":"hidden", "position":"relative"});
$(".letter-o a").hover(
function() {
$(this).parent().stop().animate({"width": "94"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-r").width(12);
$(".letter-r").css({"overflow":"hidden", "position":"relative"});
$(".letter-r a").hover(
function() {
$(this).parent().stop().animate({"width": "95"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-w").width(17);
$(".letter-w").css({"overflow":"hidden", "position":"relative"});
$(".letter-w a").hover(
function() {
$(this).parent().stop().animate({"width": "95"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "17"}, 300);
});
$(".letter-x").width(12);
$(".letter-x").css({"overflow":"hidden", "position":"relative"});
$(".letter-x a").hover(
function() {
$(this).parent().stop().animate({"width": "52"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
$(".letter-y").width(12);
$(".letter-y").css({"overflow":"hidden", "position":"relative"});
$(".letter-y a").hover(
function() {
$(this).parent().stop().animate({"width": "52"}, 300);
},
function() {
$(this).parent().stop().animate({"width": "12"}, 300);
});
});
I'm really struggling with this, i guess i need an option for disabling, but that would be making it a plugin which im not sure how to do.. and I don't want each page to have a list of enabled link items, because it's growing at the minute, so if i can do something like
$("letter-h").disableAccordion();
I hope I'm making sense, I know someone out there will have a solution, thanks for this!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您不想使用该插件的页面上(如果您反对根据页面动态加载插件),您可以
在调用后添加:包含js文件
On the page you don't wish to use the plugin (if you're against dynamically loading the plugin depending on page) you can put:
after the call to include the js file
您可以使用此代码:
You can use this code: