jquery滑块...如何自动高度?
我有一个内容滑块...检查测试用例的小提琴..
我想要实现的是,当我滑动到(无论什么).page_content 时,网页需要将高度调整到当前列(面板或其他) ....现在,显然它会调整到最高的面板...
并且请假设内容是动态加载的,所以我首先进行幻灯片,然后加载内部内容...(反之亦然...用于状态指示目的)。 ...所以我不提前知道面板高度,就像在这个测试用例中一样...
我不想删除已加载(但隐藏)面板中的内容只是为了获得正确的高度!
有什么想法吗?可以只在 CSS 中完成吗?我需要更改我的标记吗?拜托,我很绝望!
I have a content slider... check the fiddle for the test case..
what I'd like to achive is that when I slide to a (whatever) .page_content the webpage would need to adjust the height to the current column (panel or whatever)....now, obviously it adjusts to the highest panel...
and please assume, that the content is loaded dynamically, so I do the slide first, then load the content inside... (not vice-versa... for status indication purposes)....so I don't know the panel heights in advance like in this test case...
I don't want to delete content from already loaded (but hidden) panels just to get the proper height!
any ideas? can it be done just in CSS, do I need to change my markup? Please, I am desperate!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太擅长(甚至不擅长)JavaScript 和动画,但这里有一个解决方案。
只需将容器 div 的高度设置为动画,使其等于正在显示的内容 div 的高度。
http://jsfiddle.net/VDz4J/15/
I'm not great (or even good) at javascript and animations but here's a solution.
Just animate the container div's height to equal the height of the content div that's being displayed.
http://jsfiddle.net/VDz4J/15/
你可以试试这个:
对于
.page_content
设置height:auto;
(并删除列的固定高度)。然后,当您单击菜单链接时调整高度:
以下是更改:
http://jsfiddle.net/VDz4J/14/
另外假设您会使用诸如 load 之类的函数(要动态加载内容),您可以利用它的回调:
You could try this out :
For
.page_content
setheight:auto;
(and remove the fixed height for the columns).Then when you click on a menu link adjust the height :
here are the changes :
http://jsfiddle.net/VDz4J/14/
Also supposing you would use a function such as load (To load the content dynamically), you could take benefit of it's callback :