Javascript 这是什么JQuery脚本?
在右侧,有选择器选项卡(所选箭头指向左侧)Javascript 这是什么JQuery脚本?,javascript,jquery,html,css,templates,Javascript,Jquery,Html,Css,Templates,在右侧,有选择器选项卡(所选箭头指向左侧) 这是什么CSS菜单?为什么我不能在JQuery UI网站上找到它?它不是一个插件,而是页面上的一个简单的html/css/javascript 控制菜单的javascript位于中 具体部分: //Rewrite and prepare links of right-hand sub navigation $('#demo-config-menu a').each(function() { $(this).attr('targe
这是什么CSS菜单?为什么我不能在JQuery UI网站上找到它?它不是一个插件,而是页面上的一个简单的html/css/javascript 控制菜单的javascript位于中 具体部分:
//Rewrite and prepare links of right-hand sub navigation
$('#demo-config-menu a').each(function() {
$(this).attr('target', 'demo-frame');
$(this).click(function(e) {
resetDemos();
$(this).parents('ul').find('li').removeClass('demo-config-on');
$(this).parent().addClass('demo-config-on');
//Set the hash to the actual page without ".html"
window.location.hash = this.getAttribute('href').match((/\/([^\/\\]+)\.html/))[1];
loadDemo(this.getAttribute('href'));
e.preventDefault();
});
});
它只是简单的html+css。不需要javascript/jquery。查看源代码,和/或使用浏览器的dom检查器。左箭头只是一个背景图像,由css
a:hover
规则应用。@lee javascript用于添加类,使li's&a具有样式。该类未添加到a:hover上。javascript也被用来在单击时将内容加载到内容区域。@john-你说得对,但我应该指出,要使菜单具有向左箭头和鼠标悬停效果,并不需要javascript。这一切都可以通过html+css通过:hover
选择器完成。@lee,怎么做?箭头是在单击时添加的,而不是在单击时添加的hover@john你说得对。我应该说:鼠标悬停效果可以通过css:hover
实现。可以使用指定给当前选定项的单个css类来完成向左箭头。在非javascript增强的站点中,每个页面都是从服务器单独加载的,因此每个页面的菜单都会在该页面的正确菜单项上包含所选的
类。我不是说“不要为此使用javascript”,我只是指出它不是必需的。如果您确实使用js实现了这一点,那么您还需要使用某种形式的深度链接(这可能比OP需要的工作量要多)。