我找到了一个网站,其中包含向html添加自定义标签的指南,与人们制作的方式相同,即使用新的HTML5标签.我必须承认,我认为添加自己的标签会更好,可以更容易"扫描"代码,并找到您要查找的内容.但是我找到的每个网站都有人说这不好......但为什么不好呢?
示例html与类:
<ul class="commentlist">
<li class="comment odd">
<div class="1">
<div class="avatar">
<img src="http://placehold.it/60x60" width="60" height="60" />
</div>
<div class="metadata">
<div class="name">Name</div>
<p>response1</p>
</div>
</div>
<ul class="children">
<li class="comment even">
<div class="2">
<div class="avatar">
<img src="http://placehold.it/60x60" width="60" height="60" />
</div>
<div class="metadata">
<div class="name">Name</div>
<p>response1a</p>
</div>
</div>
</li>
<li class="comment odd">
<div class="3">
<div class="avatar">
<img src="http://placehold.it/60x60" width="60" height="60" />
</div>
<div class="metadata">
<div class="name">Name</div>
<p>response1b</p>
</div>
</div>
</li>
</ul>
</li>
Run Code Online (Sandbox Code Playgroud)
在这里我可以用自定义标签做什么,我认为找到自己的方式会更容易,所以为什么不呢:
<clist>
<ccommentbox class="odd">
<ccomment class="1">
<cavatar>
<img src="http://placehold.it/60x60" width="60" …Run Code Online (Sandbox Code Playgroud) 我试图制作一个图像拇指的"线",它在鼠标移动时滚动.我得到了它的工作,但我现在的问题是,我想在侧面做一个"填充",所以我不必将鼠标一直到两侧看到第一个/最后一个拇指.但我真的无法让它工作:/
这是我现在的脚本:
// MouseMove scrolling on thumbs
var box = $('.thumbs-block'),
innerBox = $('.thumbs'),
lastElement = innerBox.find('a:last-child');
var offsetPx = 100;
var boxOffset = box.offset().left;
var boxWidth = box.width() /* - (offsetPx*2)*/;
var innerBoxWidth = (lastElement[0].offsetLeft + lastElement.outerWidth(true)) - boxOffset /* + (offsetPx*2)*/;
scrollDelayTimer = null;
box.mousemove(function (e) {
console.log('boxWidth: ' + boxWidth + ' innerBoxWidth: ' + innerBoxWidth + ' box.scrollLeft(): ' + box.scrollLeft());
var mouseX = e.pageX;
var boxMouseX = mouseX - boxOffset;
if ((boxMouseX > offsetPx) && …Run Code Online (Sandbox Code Playgroud)