开发者

Specific problem developing my jquery menu

开发者 https://www.devze.com 2022-12-21 14:31 出处:网络
I am developing a menu using jquery. The menu grows dynamically, and i need to keep the appearance for each level.

I am developing a menu using jquery.

The menu grows dynamically, and i need to keep the appearance for each level. And i do, but the problem is now the browsers. IE and Mozilla.

I am u开发者_StackOverflowsing jquery to get the width of unordered lists for when i pass with the mouse over the next level opens, in that width shifter to the right

http://img85.imageshack.us/i/menuip.png/

In firefox works ok because the width is not set to "none" but a integer value, but in IE is setted to "auto" and i need a integer value to shift to the right.

Suggestions?

thanks :)


jQuery UI has a Position method which is perfect for these things.

$("#position3").position({
  my: "right center",
  at: "right bottom",
  of: "#targetElement"
});

http://docs.jquery.com/UI/Position


Not sure if this is available in IE or not but you could try getting the offset width or the scroll width.

$(this).[0].offsetWidth/scrollWidth


I'm not entirely sure, but I think the jQuery method width() should be able to compute the correct width of an element. Could you give us a code snippet describing how you get the element width?

0

精彩评论

暂无评论...
验证码 换一张
取 消