After accustomed to the web of the normal horizontal line and vertical bar, occasionally to point Slash will give a unique feeling. First look at the effect of the slash
A simple slash adds a lot to the page, but how do you draw it in a Web page? When it comes to drawing, you might have thought of it, just a little bit. Here is the code
<script type="text/javascript">
$().ready(function(){
function wirteline(o){
var myHeight=o.parent().height(); //获得高度和宽 度
var myWidth=o.parent().width();
var count=myHeight<=myWidth? myHeight:myWidth;
var divstring=" ";
for(var i=0;i<=count;i++) //循环绘制
{
divstring+="<div class='line' style='top:"+i.toString()+"px;left:"+(myWidth--).toString() +"px;'></div>";
//为什么不直接这样呢?
//o.append("<div class='line' style='top:"+i.toString()+"px;left:"+(myWidth--).toString() +"px;'></div>");
}
o.append(divstring); //如果像上面那样重复获取对象 ,会有点慢
}
wirteline($('.linebox'));
});
</script>
The basic principle is a div a pixel, which consists of a diagonal line based on the position of the div. I will not say the specific code, there are comments on it.