假设我的html设置如下:
CMB2 Object (
[cmb_id:protected] => team_member_metabox
[meta_box:protected] => Array
(
[id] => team_member_metabox
[title] => Team Member Metabox
[type] =>
[object_types] => Array
(
[0] => post_type_teammember
)
[context] => normal
[priority] => high
[show_names] => 1
[show_on_cb] =>
[show_on] => Array
(
)
[cmb_styles] => 1
[enqueue_js] => 1
[fields] => Array
(
[_cmb2_division] => Array
(
[name] => Division
[desc] => The division of the company this person works in (These can be edited in the Revolution Group theme options)
[id] => _cmb2_division
[type] => select
[options] => Array
(
)
)
[_cmb2_photo] => Array
(
[name] => Photo
[desc] =>
[id] => _cmb2_photo
[type] => file
)
[_cmb2_position] => Array
(
[name] => Position
[desc] => Job position
[id] => _cmb2_position
[type] => text
)
[_cmb2_email] => Array
(
[name] => Email
[desc] => Email address
[id] => _cmb2_email
[type] => text_email
)
[_cmb2_bio] => Array
(
[name] => Bio
[desc] =>
[id] => _cmb2_bio
[type] => wysiwyg
[options] => Array
(
[media_buttons] => 1
[textarea_rows] => 5
)
)
[_cmb2_start_year] => Array
(
[name] => Year Started
[desc] => The year the team member started with Revolution Group
[id] => _cmb2_start_year
[type] => select
[options] => Array
(
)
)
[_cmb2_certifications_repeat_group] => Array
(
[id] => _cmb2_certifications_repeat_group
[type] => group
[description] => Certifications (These can be edited in the Revolution Group theme options)
[options] => Array
(
[group_title] => Certification {#}
[add_button] => Add Another Certification
[remove_button] => Remove Certification
[sortable] => 1
)
[fields] => Array
(
[certification] => Array
(
[name] => Certification
[description] => Please select
[id] => _cmb2_certification
[type] => select
[options] => Array
(
)
)
[certification_year] => Array
(
[name] => Year Obtained
[description] => The year this certification was aquired
[id] => _cmb2_certification_year
[type] => select
[options] => Array
(
)
)
)
)
[_cmb2_skills_repeat_group] => Array
(
[id] => _cmb2_skills_repeat_group
[type] => group
[description] => Skills (These can be edited in the Revolution Group theme options)
[options] => Array
(
[group_title] => Skill {#}
[add_button] => Add Another Skill
[remove_button] => Remove Skill
[sortable] => 1
)
[fields] => Array
(
[skill] => Array
(
[name] => Skill
[description] => Please select
[id] => _cmb2_skill
[type] => select
[options] => Array
(
)
)
)
)
[_cmb2_fun_fact] => Array
(
[name] => Fun Fact
[desc] =>
[id] => _cmb2_fun_fact
[type] => wysiwyg
[options] => Array
(
[media_buttons] => 1
[textarea_rows] => 5
)
)
[_cmb2_order] => Array
(
[name] => Order
[desc] => Order that the team member should be displayed. The lower the number the hghter on the list when displayed
[id] => _cmb2_order
[type] => text
)
)
[hookup] => 1
[save_fields] => 1
[closed] =>
[new_user_section] => add-new-user
)
[object_id:protected] => 0
[object_type:protected] => post
[mb_object_type:protected] => post
[updated:protected] => Array
(
)
[mb_defaults:protected] => Array
(
[id] =>
[title] =>
[type] =>
[object_types] => Array
(
)
[context] => normal
[priority] => high
[show_names] => 1
[show_on_cb] =>
[show_on] => Array
(
)
[cmb_styles] => 1
[enqueue_js] => 1
[fields] => Array
(
)
[hookup] => 1
[save_fields] => 1
[closed] =>
[new_user_section] => add-new-user
)
[fields:protected] => Array
(
)
[hidden_fields:protected] => Array
(
)
[data_to_save] => Array
(
)
[generated_nonce:protected] =>
我想要的只是我的home_content来填充视图的其余部分,然后home_content中的任何其他内容都是溢出而不是溢出在html中,因此当用户向下滚动时,site_banner和home_menu总是在屏幕上永远不会消失。
答案 0 :(得分:0)
使用jQuery:
$("#site_content").height($(window).height()-$("#site_banner").height());
$("#home_content").css("overflow-y","auto").height($("#site_content").height()-$("#home_menu").height());
这是一个JSfiddle: http://jsfiddle.net/h1bcn5p0/
答案 1 :(得分:0)
从您所说的内容来看,您应该放置"网站横幅"和"主菜单"在标题标记中,这意味着它应该像这样结构化。
<html>
<head>
</head>
<body>
<header>
<div id="site_banner"><img></div>
<div id="home_menu"></div>
</header>
<div id="site_content">
<div id="home_content"></div>
</div>
</body>
这里有一个小提琴https://jsfiddle.net/Optiq/rx2qn1h9/
这是我添加的CSS,以便保持原状
header{
position:fixed; /*this makes it stay in place*/
display:block;
top:0px; /*this bumps it to the very top of the page*/
width:100%;
height:80px;
background-color:red;
}