如何将所有内容放在同一行?见http://jsfiddle.net/zQ5AL/4/
它不适用于2个<p>
代码
非常感谢
HTML
<p>The number is <p id="dynamic-number">1</p> . Please confirm</p>
JS
var currentNumber = $('#dynamic-number').text();
$({numberValue: currentNumber}).animate({numberValue: 900}, {
duration: 2000,
easing: 'swing',
step: function() {
$('#dynamic-number').text(Math.ceil(this.numberValue));
}
});
答案 0 :(得分:0)
p标签内不能有p标签。尝试:
<p>The number is <span id="dynamic-number">1</span> . Please confirm</p>
答案 1 :(得分:0)
只需使用span元素
<p>The number is <span id="dynamic-number">1</span> . Please confirm</p>
答案 2 :(得分:0)
检查出来:
这里是你小提琴的更新......
溶液:
<p>The number is <span id="dynamic-number">1</span> . Please confirm</p>
答案 3 :(得分:0)
试试这个:
我添加了几个css:
#dynamic-number {
color: #000;
font: bold 35px Arial;
margin-top: -10px;
padding: 0 4px;
text-align: center;
}
p { margin:0;padding:0;float:left;}
删除margin,padding
并设置float:left