我正在做一个网站。当您单击导航时,布局是水平的,它会滑动到您想要的页面。这一切都有效,但我随后为每个页面添加了一个调光器,因此当您在所选页面上时,其他页面会变暗。我想知道是否有更好的方法来编写这段代码,目前它是每个页面的一个函数,我想知道是否有办法缩短它。
//When the link that triggers the message is clicked fade in overlay/msgbox
$(".test").click(function(){
$(".dimmerservices").fadeOut('slow', function() {
// Animation complete.
});
$(".dimmerother1").fadeIn('slow', function() {
// Animation complete.
});
return false;
});
//When the message box is closed, fade out
$(".close").click(function(){
$("#fuzz").fadeOut();
return false;
});
});
$(document).ready(function(){
//Adjust height of overlay to fill screen when page loads
$("#fuzz").css("height", $(document).height());
//When the link that triggers the message is clicked fade in overlay/msgbox
$(".casestud").click(function(){
$(".dimmercase").fadeOut('slow', function() {
// Animation complete.
});
$(".dimmerother2").fadeIn('slow', function() {
// Animation complete.
});
return false;
});
//When the message box is closed, fade out
$(".close").click(function(){
$("#fuzz").fadeOut();
return false;
});
});
$(document).ready(function(){
//Adjust height of overlay to fill screen when page loads
$("#fuzz").css("height", $(document).height());
//When the link that triggers the message is clicked fade in overlay/msgbox
$(".aboutclick").click(function(){
$(".dimmerabout").fadeOut('slow', function() {
// Animation complete.
});
$(".dimmerother3").fadeIn('slow', function() {
// Animation complete.
});
return false;
});
//When the message box is closed, fade out
$(".close").click(function(){
$("#fuzz").fadeOut();
return false;
});
});
$(document).ready(function(){
//Adjust height of overlay to fill screen when page loads
$("#fuzz").css("height", $(document).height());
//When the link that triggers the message is clicked fade in overlay/msgbox
$(".contactbutton").click(function(){
$(".dimmerend").fadeOut('slow', function() {
// Animation complete.
});
$(".dimmerother4").fadeIn('slow', function() {
// Animation complete.
});
return false;
});
//When the message box is closed, fade out
$(".close").click(function(){
$("#fuzz").fadeOut();
return false;
});
});