jQuery追加元素-文本不';不适合
所以我不知道为什么这不起作用。我有以下jQuery:jQuery追加元素-文本不';不适合,jquery,css,Jquery,Css,所以我不知道为什么这不起作用。我有以下jQuery: $('#shifts').on({ click: function(event) { selectStaff($(this)); }, mouseover: function() { var match = $(this); // There is something wrong with this user. Lets write it all down
$('#shifts').on({
click: function(event)
{
selectStaff($(this));
},
mouseover: function()
{
var match = $(this);
// There is something wrong with this user. Lets write it all down
if( match.hasClass('warning') )
{
var w1 = '<div class="display_warning">This user has already been used for today.</div>';
var w2 = '<div class="display_warning">This user is not qualified to perform one or more of the tasks assigned to this shift</div>';
var warning = '<div id="display_warning">' + w1 + w2 + '</div>';
match.after(warning);
}
},
mouseout: function()
{
$('#display_warning').remove();
}
},'.staff .match');
但是,文本位于div之外,而不是div内的约束!为什么 问题是因为您为块元素指定了
宽度
和高度
。如果删除其中任何一个,则文本将在div
中换行,或者如果您对div
水平展开没有问题,则另一个选项是将其更改为min width
,或者minheight
如果你对垂直扩展div
没问题。我想你是在定义类的css。在中显示警告
。你能在另一个类中包含css属性吗????!!!而且/
不是注释此属性的正确方式!!!你必须使用/*bla-bla-bla:bla-bla-bla*/
对不起,我应该说,那是用更少的钱!所以它编译成CSS!发布编译后的CSS,最好是一个我们可以重现问题的地方,怎么样?我希望宽度是固定的。我试着给潜水艇最低高度,但那没用!嗯,这是我的意思的一把小提琴:。尝试将小提琴中的min height
更改为刚好height
,以查看差异。您还可以尝试添加空白:换行代码>选项,我已经在fiddle.square中注释掉了它。这可能与动态添加元素有关吗?不应该,但您可以通过调用.css(…)
或addClass()
#display_warning
{
float: left;
width: @shiftWidth;
background-color: @white;
padding-top: @unit;
padding-bottom: @unit;
color: @textColor;
font-size: 12px;
height: 100px;
//border: 1px sol;
.display_warning
{
float: left;
width: @shiftWidth;
//text-align: center;
}
}