Fix the style switcher in a way that is standard conformant *and* working

This commit is contained in:
Matthias Schiffer 2012-06-16 16:03:19 +02:00
parent e2347fa020
commit a764f8e999
2 changed files with 7 additions and 5 deletions

View file

@ -5,13 +5,15 @@ function switch_style(s) {
for (var i = 0; i < el.length; i++ ) { for (var i = 0; i < el.length; i++ ) {
if (el[i].getAttribute("rel").indexOf("style") != -1 if (el[i].getAttribute("rel").indexOf("style") != -1
&& el[i].getAttribute("title")) { && el[i].getAttribute("title")) {
if (el[i].getAttribute("title") == s) { /* always set to true first to workaround Chrome bug */
style_btn.text(s) el[i].disabled = true
if (el[i].getAttribute("title") == s)
el[i].disabled = false el[i].disabled = false
} else
el[i].disabled = true
} }
} }
style_btn.text(s)
} }
function getOffset( el ) { function getOffset( el ) {

View file

@ -5,7 +5,7 @@
<title>Freifunk Lübeck - Knotengraph</title> <title>Freifunk Lübeck - Knotengraph</title>
<link href='style.css' rel='stylesheet' type='text/css' /> <link href='style.css' rel='stylesheet' type='text/css' />
<link href='force.css' rel='stylesheet' type='text/css' /> <link href='force.css' rel='stylesheet' type='text/css' />
<link href='force-big.css' rel='alternate stylesheet' type='text/css' title='big' disabled/> <link href='force-big.css' rel='alternate stylesheet' type='text/css' title='big'/>
<link href='force-light.css' rel='stylesheet' type='text/css' title='light'/> <link href='force-light.css' rel='stylesheet' type='text/css' title='light'/>
<script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="d3.v2.js"></script> <script type="text/javascript" src="d3.v2.js"></script>