【发布时间】:2013-12-03 11:25:56
【问题描述】:
我有一个手风琴菜单和粘性滚动链接,它们单独工作绝对正常。
我现在需要做的是将滚动菜单链接到手风琴,以便在单击手风琴菜单和粘性滚动菜单时打开手风琴选项卡。
当用户点击滚动菜单项时,我需要制作手风琴菜单以打开。
如何将切换功能也动态链接到粘性滚动菜单?
这两个我没有使用任何插件,所以请建议我不要使用插件。谢谢。
这是我的代码
$(document).ready(function () {
//Sticky scroll menu
var top = $('.sticky-scroll-box').offset().top;
$(window).scroll(function (event) {
var y = $(this).scrollTop();
if (y >= top) {
$('.sticky-scroll-box').addClass('fixed');
} else {
$('.sticky-scroll-box').removeClass('fixed');
}
$('.sticky-scroll-box').width($('.sticky-scroll-box').parent().width());
});
//Accordion
$(".menu_body").hide();
//toggle the componenet with class menu_body
$(".menu_head").click(function(){
$(this).next(".menu_body").slideToggle(400);
var plusmin;
plusmin = $(this).children(".plusminus").text();
$(this).children("span.down-arrow").toggleClass("up-arrow");
});
});
【问题讨论】:
标签: javascript jquery accordion