in IE8 using jQuery JSTree when scrolling the clic

2019-04-02 13:19发布

问题:

I'm using JStree to create a basic tree. In every browser this opens, closes,... fine except in IE8. I narrowed the problem down to this:

When I don't scroll the page and the tree is positioned at the top of the page all clicks work fine.

When I have scrolled the page (eg 20px) and then try to open the tree this doesn't work. The weird thing is that if I click 20px above the arrow to open the tree this works. The amount of pixels I need to click above the actual arrow depends on how much I've scrolled on the page.

I guess this has something to do with the positioning of some elements but I can't figure it out. Does anyone have any experience or is there a known bug in JSTree or IE8 for this?

Many thanks

回答1:

Question (and might also be the answer): are you using the latest version? JSTree suffered a complete rewrite in v1.0rc.



回答2:

Hey PhysX, I ran into this same problem and had to fix it. I couldn't find any versions of jsTree that worked, but I did find that if I set IE8 to use "Compatability View" mode, the problem went away. My next thought was "How can I force the user's browser to use this mode?" I researched compatability view here, and found that I could fix the problem just by inserting this meta tag:

<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
<title>My Tree</title>

This isn't an ideal solution because the rest of your website may not want this mode, but it worked for me.