HTML设置
<div id="fixed-wrapper">
<div id="header">
<h1>Site Name</h1>
</div>
<div id="leftCol"></div>
<div id="centerCol"></div>
<div id="rightCol"></div>
Run Code Online (Sandbox Code Playgroud)
CSS:
#fixed-wrapper{
min-width: 1264px;
}
#header{
width: 100%;
height: 75px;
text-align: center;
}
#header h1
{
line-height: 75px;
}
#centerCol {
margin-left: 310px;
margin-right: 360px;
height: 100%;
min-width: 604px;
}
#rightCol {
width: 285px;
height: auto;
position: absolute;
top: 75px;
right: 0;
margin-right: 75px;
}
#leftCol {
width: 235px;
height: auto;
position: absolute;
top: 75px;
left: 0;
margin-left: 75px;
}
Run Code Online (Sandbox Code Playgroud)
问题是中心列需要具有最小宽度,但右列不应移动到中心列.
我有一个创建和填充选择列表的视图.我想在Change事件上绑定一个事件(当用户选择一个不同的Option时.
它只是输出接近这个的东西:
<select>
<option value="id">ID Name</option
</select>
Run Code Online (Sandbox Code Playgroud)
风景:
App.Views.SessionList = Backbone.View.extend({
tagName: 'select',
id: 'sessionList',
events: {
'change': 'selectionChanged'
},
initialize: function () {
// Load Collection
_.bindAll(this, 'selectionChanged');
this.template = _.template($('#optionsTemplate').html());
this.Sessiontemplate = _.template($('#session_template').html());
this.SelectedSessiontemplate = _.template($('#selected_session_template').html());
// Create Collection
this.SessionList = new App.Collections.SessionList();
// Set Bindings
this.SessionList.bind('add', this.addSession, this);
this.SessionList.bind('reset', this.addSessions, this);
this.render();
this.SessionList.fetch();
},
render: function () {
return this;
},
addSession: function (item, num) {
if (num === 0) {
$(this.el).append(this.SelectedSessiontemplate(item.toJSON()));
console.log("Selected");
}
else {
$(this.el).append(this.Sessiontemplate(item.toJSON())); …Run Code Online (Sandbox Code Playgroud)