我有一个非常奇怪的错误。当我使用 sIFR 替换单个 h1 元素时,页面上的其他所有内容都会消失。这真的很奇怪。我没有收到任何 javascript 错误。
如果我在 sifr-config 中编辑掉 sIFR.activate 函数,一切都会正常显示...
这是我的代码... HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>sIFR test</title>
<link rel="stylesheet" href="css/sifr.css" type="text/css">
<link rel="stylesheet" href="css/index.css" type="text/css">
<script src="js/sifr.js" type="text/javascript"></script>
<script src="js/sifr-config.js" type="text/javascript"></script>
</head>
<body>
<h1>Dette er en overskrift</h1>
<ul class="menu">
<li class="parent active"><a href="#"><span>Main Menu Item 1</span></a>
<ul>
<li><a href="#"><span>Sub Menu Item 1</span></a></li>
<li><a href="#"><span>Sub Menu Item 2</span></a></li>
<li><a href="#"><span>Sub Menu Item 3</span></a></li>
<li><a href="#"><span>Sub Menu Item 4</span></a></li>
<li><a href="#"><span>Sub Menu Item 5</span></a></li>
</ul>
</li>
<li class="parent"><a href="#"><span>Main Menu Item 2</span></a>
<ul>
<li><a href="#"><span>Sub Menu Item 1</span></a></li>
<li><a href="#"><span>Sub Menu Item 2</span></a></li>
<li><a href="#"><span>Sub Menu Item 3</span></a></li>
<li><a href="#"><span>Sub Menu Item 4</span></a></li>
<li><a href="#"><span>Sub Menu Item 5</span></a></li>
</ul>
</li>
<li><a href="#"><span>Main Menu Item 3</span></a></li>
<li class="parent"><a href="#"><span>Main Menu Item 4</span></a>
<ul>
<li><a href="#"><span>Sub Menu Item 1</span></a></li>
<li><a href="#"><span>Sub Menu Item 2</span></a></li>
</ul>
</li>
<li><a href="#"><span>Main Menu Item 5</span></a></li>
</ul>
<br class="clearfloat" />
</body>
</html>
sifr-config.js:
var helvetica57 = { src: 'sifr/helveticaNeue57Condensed.swf' };
var helvetica67 = { src: 'sifr/helveticaNeue67Medium.swf' };
sIFR.activate(helvetica57, helvetica67);
sIFR.replace(helvetica67, {
selector: 'h1',
css: '.sIFR-root {color: #000000; }'
});
您可以在此处查看示例:www.runemadsen.com/innovation/sifr