|
| |
|
|
Scotty
Posts: 223 Status: offline
|
CSS horizontal drop menu - 4/28/2008 14:52:52
I just noticed our drop menu is not working properly in Internet Explorer...www.loghomestore.com. With firefox, everything is fine, in Explorer there are white lines/spaces between some of the items...example, hover over tools and you can slide down the first two items, then you get to a space before the next item "drilling", and that's as far as you can go. What did I do wrong?...and is this a function of my opening pages/editing with WSIWG editor (Kompozer). Regards, Scotty
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu - 4/28/2008 22:40:51
It worked...so far. First I set up a 'compliant' page. www.loghomestore.com/compliant.html. Ran the w3c test and got a passing grade :) Then I took the first section of the horizontal css drop menu "books" and removed the 'white spaces' by moving the <li> up one line to be next to </li>...thus </li><li>, for it and all it's sub menus...and it works in Firefox and IE. Anyone have time to look in Opera or ?...what other browsers should I check? Regards, Scotty Update: I'm part way through this process and it looks like it's going to royally confuse IE...it's starting to show blank boxes, slow loading boxes, boxes which shouldn't (yet) be open. I'll keep slogging, however I'm wondering if I should revert back to our previous js drop menu? Anyone successfully using a horizontal css drop menu in IE? What flavor is it? Regards, Scotty
< Message edited by Scotty -- 4/28/2008 23:42:32 >
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 4/29/2008 21:24:04
With tailspins' permission I loaded the fix and viola...drop downs work in current IE. You musta been a fighter pilot in a previous incarnation...that was quick. Regards, Scotty
|
|
|
|
Tailslide
Posts: 6692 Joined: 5/10/2005 From: Out here on the raggedy edge Status: offline
|
RE: CSS horizontal drop menu problem in IE - 4/30/2008 6:58:53
Ok - 2 things. Firstly - yes removing the whitespace works but on a menu that size I wouldn't use it - it'll be a nightmare to edit. I used it primarily to show that it was the whitespace bug causing the issue. There are better ways of fixing it. In the test page I've posted I've changed the menu back to the properly indented form to make life easier to edit it and I've added two little rules for your CSS: #navigation li li a { display: inline-block; }
#navigation li li a { display: block; } Put these after all your other #navigation rules in the stylesheet. This fixes it for IE7. Oddly - in IE6 and under the whitespace bug wasn't showing... go figure. Just copy and paste the navigation list back into your page from my test page. Secondly, to make the dropdowns drop down in IE6 and under, copy the following code into a blank page of Notepad or whatever and save it as csshover.htc - upload it to your webserver. <attach event="ondocumentready" handler="parseStylesheets" />
<script>
/**
* Whatever:hover - V1.42.060206 - hover & active
* ------------------------------------------------------------
* (c) 2005 - Peter Nederlof
* Peterned - http://www.xs4all.nl/~peterned/
* License - http://creativecommons.org/licenses/LGPL/2.1/
*
* Whatever:hover is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Whatever:hover is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* Credits and thanks to:
* Arnoud Berendsen, Martin Reurings, Robert Hanson
*
* howto: body { behavior:url("csshover.htc"); }
* ------------------------------------------------------------
*/
var csshoverReg = /(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i,
currentSheet, doc = window.document, hoverEvents = [], activators = {
onhover:{on:'onmouseover', off:'onmouseout'},
onactive:{on:'onmousedown', off:'onmouseup'}
}
function parseStylesheets() {
if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
window.attachEvent('onunload', unhookHoverEvents);
var sheets = doc.styleSheets, l = sheets.length;
for(var i=0; i<l; i++)
parseStylesheet(sheets);
}
function parseStylesheet(sheet) {
if(sheet.imports) {
try {
var imports = sheet.imports, l = imports.length;
for(var i=0; i<l; i++) parseStylesheet(sheet.imports);
} catch(securityException){}
}
try {
var rules = (currentSheet = sheet).rules, l = rules.length;
for(var j=0; j<l; j++) parseCSSRule(rules[j]);
} catch(securityException){}
}
function parseCSSRule(rule) {
var select = rule.selectorText, style = rule.style.cssText;
if(!csshoverReg.test(select) || !style) return;
var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');
var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);
var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1];
var affected = select.replace(/:(hover|active).*$/, '');
var elements = getElementsBySelect(affected);
if(elements.length == 0) return;
currentSheet.addRule(newSelect, style);
for(var i=0; i<elements.length; i++)
new HoverElement(elements, className, activators[pseudo]);
}
function HoverElement(node, className, events) {
if(!node.hovers) node.hovers = {};
if(node.hovers[className]) return;
node.hovers[className] = true;
hookHoverEvent(node, events.on, function() { node.className += ' ' + className; });
hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); });
}
function hookHoverEvent(node, type, handler) {
node.attachEvent(type, handler);
hoverEvents[hoverEvents.length] = {
node:node, type:type, handler:handler
};
}
function unhookHoverEvents() {
for(var e,i=0; i<hoverEvents.length; i++) {
e = hoverEvents;
e.node.detachEvent(e.type, e.handler);
}
}
function getElementsBySelect(rule) {
var parts, nodes = [doc];
parts = rule.split(' ');
for(var i=0; i<parts.length; i++) {
nodes = getSelectedNodes(parts, nodes);
} return nodes;
}
function getSelectedNodes(select, elements) {
var result, node, nodes = [];
var identify = (/\#([a-z0-9_-]+)/i).exec(select);
if(identify) {
var element = doc.getElementById(identify[1]);
return element? [element]:nodes;
}
var classname = (/\.([a-z0-9_-]+)/i).exec(select);
var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;
for(var i=0; i<elements.length; i++) {
result = tagName? elements.all.tags(tagName):elements.all;
for(var j=0; j<result.length; j++) {
node = result[j];
if(classReg && !classReg.test(node.className)) continue;
nodes[nodes.length] = node;
}
}
return nodes;
}
</script> This code comes from here: http://www.xs4all.nl/~peterned/csshover.html Now at the bottom of your stylesheet add this: body { behavior:url("csshover.htc"); } Making sure the path to the file from the stylesheet is correct - i.e. in this case it's in the same directory (in the example I've got all the rules in the document head). And that's it. The example will look a little odd because I've stuck all your CSS rules into the document head so all the paths to the images etc will be off - so ignore that.
_____________________________
Little Blue Plane Web Design | Land Rover project
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/18/2008 23:45:59
quote:
Secondly, to make the dropdowns drop down in IE6 and under, copy the following code into a blank page of Notepad or whatever and save it as csshover.htc Do I save as htc? or htm?...How do I open if htc? Planting grapes in our 'spare time'...taking me awhile to get back to this. Regards, Scotty Go Obama!
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/21/2008 12:43:29
Okay...I installed everything as I understood it to be...isn't working...do you have time to take a look? Grapes are growing faster than we can prune and train...should end up with some great Pinot Noir (I think in France this is called Burgandy). Regards, Scotty
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/21/2008 20:55:06
I have the stylesheet 'Main' in the css folder (that's where I had also put csshover.htc). To rename it to reside in the css folder it would be: body { behavior:url("main/csshover.htc"); } ? I tried editing the stylesheet (Main) with that...no luck. What am I missing? Windy and warm here today. Regards, Scotty
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/22/2008 18:52:31
So, how about I place it in a different location? To rename it to reside in the media folder (Media folder is 1 level up from css folder, css is the folder that both main (stylesheet), and csshover.htc currently reside in. So would that address be: body { behavior:url("media/csshover.htc"); } Thanks for the time. Regards, Scotty
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/23/2008 0:11:36
Tailslide; I got to thinking about what you said regarding not seeing the csshover.htc in the folder with Main (Stylesheet). I went to a Browser then: I typed in: http://www.loghomestore.com/media/css/main : and this I could open then I tried: http://www.loghomestore.com/media/css/csshover.htc : and this apparently doesn't exist...but wait...I see a little ~ sign at the end of csshover.htc, so I slide the column width bar over and lo and behold, it says 'csshover.htc.htc...my my my...so a quick rename and I try it in Firefox...and it opens...woopee! Then I try it in IE6...it opens a blank screen/page...and the drop still doesn't work. Am I getting closer? Scotty
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/23/2008 10:24:35
quote:
#navigation li li a:link { padding: 0 18px 0 .4em } Tailslide; I added this to the Main/Stylesheet file...Doesn't seem to be working yet...I'll look again in a few hours to see if I saved it wrong. You mentioned previously how much fun drop menus can be...geez louise...my old java script menu was a piece of cake...but I figure if I use css I'll eventually learn to like it. My pardner, Tracy Mae, is starting to mumble about needing a 'Scotland fix'...wouldn't be surprised to see her and her mum, head to Edinburgh next spring...once a Scot, always a Scot. Regards, Scotty
< Message edited by Scotty -- 6/24/2008 0:40:07 >
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/25/2008 22:36:34
Explain to me please the concept behind <a linkindex="1"...etc. Is this the 'bit' you changed in the stylesheet? Going to 95 degrees F this weekend...might finally dig out the hammock. Regards, Scotty
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 6/27/2008 23:58:12
Geez...I went to your 'test' page (and thankyou muchly for that), and followed it to 'scottycss.css', which I then pasted into and renamed 'main', assuming our drop menu should now work in IE6 as it's the same stylesheet that works in your TEST. Nope...am I part way there? Regards, Scotty
|
|
|
|
Scotty
Posts: 223 Status: offline
|
RE: CSS horizontal drop menu problem in IE - 7/13/2008 21:39:28
file heirarchy is a real slog for me... Here's what I have so far... Media\javascript \csshover.htc \images \pictures \css Inside \css I have... \alt \main (this is the stylesheet) \csshover.htc (I put this about everywhere) \lightbox \print I don't see mention of html file at either level...do I need to go higher? Couple of wild turkeys just outside the office window, in the shade of a big Maple...on a 93F degree day. Regards, Scotty
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|