Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Dropdown menu stays open in IE7

Reply
Thread Tools

Dropdown menu stays open in IE7

 
 
dorayme
Guest
Posts: n/a
 
      09-17-2008
After posting similar in another forum a few hours ago, it strikes me I
should have subscribed to this group and included it here. There may be
a simple js tweak that someone knows or can think of:

Under specific conditions, I have noticed a problem in IE7 with a
popular dropdown method. In IE7, the dropdown fails to spring back up if
you focus on another app or window and come back to the doc with the
dropdown. Anyone come across this who can suggest a simple solution or
find where such is outlined please:

<http://dorayme.890m.com/alt/IE7DDFocusProblem.html>

--
dorayme
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      09-18-2008
dorayme wrote:
> Under specific conditions, I have noticed a problem in IE7 with a
> popular dropdown method. In IE7, the dropdown fails to spring back up if
> you focus on another app or window and come back to the doc with the
> dropdown. Anyone come across this who can suggest a simple solution or
> find where such is outlined please:
>
> <http://dorayme.890m.com/alt/IE7DDFocusProblem.html>


I can confirm the described behavior in Mozilla/4.0 (compatible; MSIE 7.0;
Windows NT 5.1; {3E1C4754-F096-BBFE-CD76-3B2E8F19E202}; .NET CLR 1.1.4322;
..NET CLR 2.0.50727).

It may be related to the fact that the value of the `class' attribute when
the `li' element is hovered over, is invalid. The attribute value is
defined to be a whitespace-separated list of CSS class names, meaning
whitespace must be between class names, not preceding a single class name.
However, the too simple

sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}

in the error-prone and too complicated

sfHover = function() {
// ...
}

just does that. The event listener should be declared a function --

function sfHover()
{
// ...
}

-- and should test whether it is OK to precede the new class name with
whitespace:

sfEls[i].onmouseover = function() {
if (this.className)
{
this.className += " sfhover";
}
else
{
this.className = "sfHover";
}
}

That said, IE 7 supports the :hover CSS pseudo-class for `li' elements, so
unless you want to blend-in the menu or achieve similar effects, you do not
need scripting for that (STFW). So

if (window.attachEvent) window.attachEvent("onload", sfHover);

in there is pointless in several respects (STFW for "attachEvent").

<body onload="sfHover()">

suffices and is standards-compliant, whereas sfHover() should be declared
before as follows:

<script type="text/javascript">
function sfHover() {}
</script>

<!--[if lt IE 7]>
<script type="text/javascript">
function sfHover()
{
// ...
}
</script>
<![endif]-->

There remains the issue of detecting the capabilities of UAs not based on
MSHTML, though.

Incidentally, Suckerfish really sucks.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
 
Reply With Quote
 
 
 
 
dorayme
Guest
Posts: n/a
 
      09-18-2008
In article <(E-Mail Removed)>,
Thomas 'PointedEars' Lahn <(E-Mail Removed)> wrote:

> dorayme wrote:
> > Under specific conditions, I have noticed a problem in IE7 with a
> > popular dropdown method. In IE7, the dropdown fails to spring back up if
> > you focus on another app or window and come back to the doc with the
> > dropdown. Anyone come across this who can suggest a simple solution or
> > find where such is outlined please:
> >
> > <http://dorayme.890m.com/alt/IE7DDFocusProblem.html>

>
> I can confirm the described behavior in Mozilla/4.0 (compatible; MSIE 7.0;
> Windows NT 5.1; {3E1C4754-F096-BBFE-CD76-3B2E8F19E202}; .NET CLR 1.1.4322;
> .NET CLR 2.0.50727).
>
> It may be related to the fact that the value of the `class' attribute when
> the `li' element is hovered over, is invalid. The attribute value is
> defined to be a whitespace-separated list of CSS class names, meaning
> whitespace must be between class names, not preceding a single class name.
> However, the too simple
>
>...


> That said, IE 7 supports the :hover CSS pseudo-class for `li' elements, so
> unless you want to blend-in the menu or achieve similar effects, you do not
> need scripting for that (STFW). So
> ...
>
> There remains the issue of detecting the capabilities of UAs not based on
> MSHTML, though.
>
> Incidentally, Suckerfish really sucks.
>


Thanks for your information. It seemed a queer bug in IE7.

I have a "solution" now, it was detected by someone at alt.html. You can
read the thread there (similar subject name and recent). Basically it
was reaction by IE7 to a lack of a change in styling between the state
of a link and its hover, IE7 seems to need various differences. For
example commenting out

dropDownNav, .dropDownNav ul {
padding: 0;
margin: 0;
color: #00c;
background: #ffc;
/* list-style-type: none; */
line-height: 1.8;
}

stops the queer phenomenon. Odd bug but have we not come to expect such
from IE?

Seems to have nothing to do with the script. Reason I posted is I was
not sure if there was something in the script IE7 was not liking
(whether it needed it or not. And whether it needed it or not, I kept
forgetting! I know that IE6 needs it. (I can test for IE6 but not for
IE7 just at the moment.)

Well, I am no fan of dropdwns (never used one) but there came a moment
where a one level one was a temptation considering it was not essential
but would be useful for most people. Not sure why you say Suckerfish
sucks. I would be particular interest in hearing why the example I gave
(not some other example or multilevel or anything else) sucks in plain
real life consequences (like, it does not work in popular enough browser
x, or it really mucks things up for blind folk, or whatever.)

--
dorayme
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IE7 DropDown Menu stays dropped. dorayme HTML 19 09-18-2008 11:10 AM
sony dvd burner, tray stays open jvalchine Computer Support 1 02-21-2006 07:24 AM
Excel.exe Process stays open in my "Task Manager" (C# ASP.Net Development) Leeor Chernov ASP .Net 4 12-15-2005 08:30 AM
DOS window stays open when executing from a batch file Alan C++ 8 06-24-2005 10:03 PM
Select dropdown box bleeds into Javascript dropdown menu Mike HTML 1 12-18-2003 09:49 PM



Advertisments