网站主页的JS下拉菜单如何让它随系统分辩率改变而改变
网站主页的JS菜单如何让它随系统分辩率改变而改变,我找了一个绝对位置的一个JS菜单,系统分辩率改变,菜单的位置不正确。menu_tpl.jsvarMENU_TPL=[//...
网站主页的JS菜单如何让它随系统分辩率改变而改变,我找了一个绝对位置的一个JS菜单,系统分辩率改变,菜单的位置不正确。
menu_tpl.js
var MENU_TPL = [
// root level configuration (level 0)
{
// item sizes
'height': 24,
'width': 121,
// absolute position of the menu on the page (in pixels)
// with centered content use Tigra Menu PRO or Tigra Menu GOLD
'block_top': 113,
'block_left': 79,
// offsets between items of the same level (in pixels)
'top': 0,
'left': 122,
// time delay before menu is hidden after cursor left the menu (in milliseconds)
'hide_delay': 200,
// submenu expand delay after the rollover of the parent
'expd_delay': 200,
// names of the CSS classes for the menu elements in different states
// tag: [normal, hover, mousedown]
'css' : {
'outer' : ['m0l0oout', 'm0l0oover'],
'inner' : ['m0l0iout', 'm0l0iover']
}
},
// sub-menus configuration (level 1)
// any omitted parameters are inherited from parent level
{
'height': 24,
'width': 121,
// position of the submenu relative to top left corner of the parent item
'block_top': 24,
'block_left': 0,
'top': 23,
'left': 0,
'css' : {
'outer' : ['m0l1oout', 'm0l1oover'],
'inner' : ['m0l1iout', 'm0l1iover']
}
},
// sub-sub-menus configuration (level 2)
{
'block_top': 5,
'block_left': 160
}
// the depth of the menu is not limited
// make sure there is no comma after the last element
];
QQ176980281或zhxl852000@163.com找到类似的发给我也行
谢谢了,要快。 展开
menu_tpl.js
var MENU_TPL = [
// root level configuration (level 0)
{
// item sizes
'height': 24,
'width': 121,
// absolute position of the menu on the page (in pixels)
// with centered content use Tigra Menu PRO or Tigra Menu GOLD
'block_top': 113,
'block_left': 79,
// offsets between items of the same level (in pixels)
'top': 0,
'left': 122,
// time delay before menu is hidden after cursor left the menu (in milliseconds)
'hide_delay': 200,
// submenu expand delay after the rollover of the parent
'expd_delay': 200,
// names of the CSS classes for the menu elements in different states
// tag: [normal, hover, mousedown]
'css' : {
'outer' : ['m0l0oout', 'm0l0oover'],
'inner' : ['m0l0iout', 'm0l0iover']
}
},
// sub-menus configuration (level 1)
// any omitted parameters are inherited from parent level
{
'height': 24,
'width': 121,
// position of the submenu relative to top left corner of the parent item
'block_top': 24,
'block_left': 0,
'top': 23,
'left': 0,
'css' : {
'outer' : ['m0l1oout', 'm0l1oover'],
'inner' : ['m0l1iout', 'm0l1iover']
}
},
// sub-sub-menus configuration (level 2)
{
'block_top': 5,
'block_left': 160
}
// the depth of the menu is not limited
// make sure there is no comma after the last element
];
QQ176980281或zhxl852000@163.com找到类似的发给我也行
谢谢了,要快。 展开
2个回答
展开全部
你试下这个
<script>
if (screen.width==800)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s800.css\" type=\"text\/css\" \/>")
else if (screen.width==1024)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1024.css\" type=\"text\/css\" \/>")
else if (screen.width==1152)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1152.css\" type=\"text\/css\" \/>")
else if (screen.width==1280)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1280.css\" type=\"text\/css\" \/>")
else if (screen.width==1440)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1600.css\" type=\"text\/css\" \/>")
else if (screen.width==1600)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1680.css\" type=\"text\/css\" \/>")
else if (screen.width==1680)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1440.css\" type=\"text\/css\" \/>")
else if (screen.width==1920)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1920.css\" type=\"text\/css\" \/>")
</script>
然后建立几个CSS来控制菜单的位置
<script>
if (screen.width==800)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s800.css\" type=\"text\/css\" \/>")
else if (screen.width==1024)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1024.css\" type=\"text\/css\" \/>")
else if (screen.width==1152)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1152.css\" type=\"text\/css\" \/>")
else if (screen.width==1280)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1280.css\" type=\"text\/css\" \/>")
else if (screen.width==1440)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1600.css\" type=\"text\/css\" \/>")
else if (screen.width==1600)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1680.css\" type=\"text\/css\" \/>")
else if (screen.width==1680)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1440.css\" type=\"text\/css\" \/>")
else if (screen.width==1920)
document.writeln("<link rel=\"stylesheet\" href=\"css\/s1920.css\" type=\"text\/css\" \/>")
</script>
然后建立几个CSS来控制菜单的位置
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询