Ooops! I discovered another problem with IE. If the element that was clicked on (e.target) is an image tag with a src attribute, IE sees that attribute as qualifying as an href property of the image tag. So this messes things up. I've decided to therefore do everything in a manner that IE can handle and that also will work in other browsers:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://mootools.net/download/get/mootools-1.2.4-core-yc.js"></script>
<script type="text/javascript" src="mootools-1.2.4.2-more.js"></script>
<script type="text/javascript">
document.write('<style type="text/css">#mainContent {visibility: hidden;}<\/style>');
window.addEvent('domready', function(){
var MC = $('mainContent'), myPanel = new Fx.Slide(MC).hide(), lnks = $(document.body).getElements('a'), a, t, tp, tc, cn;
myPanel.addEvent('start', function(){MC.setStyle('visibility', 'visible');});
myPanel.slideIn();
$$('.menu').addEvent('click', function(e){
e.stop();
cn = 0;
t = tp = tc = e.target;
while(lnks.indexOf(tp) < 0 && lnks.indexOf(tc) < 0){
tp = tp.parentNode || {parentNode: null};
tc = t.getElementsByTagName('a')[cn++] || null;
}
a = lnks.indexOf(tp) > -1? tp : lnks.indexOf(tc) > -1? tc : null;
if(a && a.href){
myPanel.addEvent('complete', function() {
location = a;
});
myPanel.slideOut();
}
});
});
</script>
</head>
<body>
<ul>
<li class="menu"><a href="page2.html">Page 2</a></li>
<li class="menu"><a href="page3.html"><span>Page 3</span></a></li>
<li class="menu"><a name="ulMenu">Dummy</a></li>
</ul>
<div id="mainContent">content here!</div>
</body>
</html>
Bookmarks