jquery div隐藏和显示,如何控制显示div的位置? [英] jquery div hidden and show, how to control show div's position?

查看:122
本文介绍了jquery div隐藏和显示,如何控制显示div的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做一个简单的div悬停节目并隐藏在默认代码中使用jQuery引入单词。所有引入的单词位置都是相对的。 引入单词 div的 box4 box8 将会 div #main



怎么办?那么 box4 box8 的介绍词div会正确对齐吗?



因为我无法用英语描述,所以我拍了一张照片。你可以看到当悬停在 box4 时,引入单词 div的权利不会超出 div #main ,这就是我需要的。谢谢。



此处代码链接:


I make an easy div hover show and hide introduce words with jQuery, in the default code. All the introduced words position is relative. the introduce words div's of box4 and box8 will out of the div#main.

and how to do? so that the introduce words div of box4 and box8 will make a right align?

For I can not describe well in english, I make a picture. you can see when hover in box4, the introduce words div's right will not out of the div#main, this is what I need. Thanks.

code link here: http://jsfiddle.net/KTGUz/

image:

解决方案

Pure jQuery way is $('.box:nth-child(4n+4)').addClass('oy'); and adjust your positioning to make the .box relative and the .hover absolute, making .oy {right: 0;}

Here's the stuff: http://jsfiddle.net/3jGdm/

这篇关于jquery div隐藏和显示,如何控制显示div的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆