I'm trying to make my first chrome extension here.It's a sticky note board. But when I try to drag the first element on my board using JQueryUI it leaves horizontal lines as traces in chrome.
我正试图在这里制作我的第一个镀铬扩展。这是一个粘滞便笺板。但是当我尝试使用JQueryUI拖动我的主板上的第一个元素时,它会将水平线留在chrome中作为跟踪。
Here's a screenshot.
这是一个截图。
Here's is the code.
这是代码。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Sticky notes using CSS3 and Google Fonts (Step 5)</title>
<link href="http://fonts.googleapis.com/css?family=Reenie+Beanie:regular" rel="stylesheet" type="text/css">
<style type="text/css">
body{
font-family:arial,sans-serif;
font-size:100%;
background:#666;
color:#fff;
}
h2,p{
font-size:100%;
font-weight:normal;
}
ul,li{
list-style:none;
}
ul{
overflow:hidden;
padding:3em;
}
ul li div{
color:#000;
background:#ffc;
min-height:10em;
min-width:10em;
padding:1em;
-moz-box-shadow:5px 5px 7px rgba(33,33,33,1);
-webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);
box-shadow: 5px 5px 7px rgba(33,33,33,.7);
-moz-transition:-moz-transform .15s linear;
-o-transition:-o-transform .15s linear;
-webkit-transition:-webkit-transform .15s linear;
}
ul li{
margin:1em;
float:left;
}
ul li h2{
font-size:140%;
font-weight:bold;
padding-bottom:10px;
}
ul li p{
font-family:"Reenie Beanie",arial,sans-serif;
font-size:180%;
}
ul li div{
-webkit-transform: rotate(-6deg);
-o-transform: rotate(-6deg);
-moz-transform:rotate(-6deg);
}
ul li:nth-child(even) div{
-o-transform:rotate(4deg);
-webkit-transform:rotate(4deg);
-moz-transform:rotate(4deg);
position:relative;
top:5px;
background:#cfc;
}
ul li:nth-child(3n) div{
-o-transform:rotate(-3deg);
-webkit-transform:rotate(-3deg);
-moz-transform:rotate(-3deg);
position:relative;
top:-5px;
background:#ccf;
}
ul li:nth-child(5n) div{
-o-transform:rotate(5deg);
-webkit-transform:rotate(5deg);
-moz-transform:rotate(5deg);
position:relative;
top:-10px;
}
ul li div:hover,ul li div:focus{
box-shadow:10px 10px 7px rgba(0,0,0,.7);
-moz-box-shadow:10px 10px 7px rgba(0,0,0,.7);
-webkit-box-shadow: 10px 10px 7px rgba(0,0,0,.7);
-webkit-transform: scale(1.25);
-moz-transform: scale(1.25);
-o-transform: scale(1.25);
position:relative;
z-index:5;
}
ol{text-align:center;}
ol li{display:inline;padding-right:1em;}
ol li div{color:#fff;}
</style>
<script src="jquery-1.8.0.min.js"></script>
<script src="jquery-ui-1.8.23.custom.min.js"></script>
<script src="step.js"></script>
</head>
<body>
<ol>
<li><a href="step1.html">Step #1</a></li>
<li><a href="step2.html">Step #2</a></li>
<li><a href="step3.html">Step #3</a></li>
<li><a href="step4.html">Step #4</a></li>
<li><strong>Step #5</strong></li>
<li><a href="#"></a></li>
</ol>
<ul>
<li >
<div class="dragable">
<h2>Title #1</h2>
<p >Text Content #1</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #2</h2>
<p>Text Content #2</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #3</h2>
<p>Text Content #3</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #4</h2>
<p>Text Content #4</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #5</h2>
<p>Text Content #5</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #6</h2>
<p>Text Content #6</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #2</h2>
<p>Text Content #2</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #7</h2>
<p>Text Content #7</p>
</div>
</li>
<li>
<div class="dragable">
<h2>Title #8</h2>
<p>Text Content #8</p>
</div>
</li>
</ul>
</body>
</html>
and the javascript
和JavaScript
$(document).ready(function() {
$(function() {
$(".dragable").draggable().bind('click', function(){
$(this).focus();
});
});
$('.dragable').bind('click', function() {
$(this).attr('contenteditable', 'true');
}).blur(
function() {
$(this).attr('contenteditable', 'false');
});
})
Note: After some experimentation I found that the problem is with -webkit-transform If I comment them out, the problem doesn't show up.
注意:经过一些实验,我发现问题出在-webkit-transform上如果我将它们注释掉,问题就不会出现了。
2 个解决方案
#1
48
Finally I have a working workaround .
最后,我有一个工作的解决方法。
Just using outline: 1px solid transparent;
on the div fixes the problem :)
只需使用轮廓:1px实心透明;在div修复问题:)
It's an anti-aliasing issue.
这是一个消除锯齿的问题。
#2
0
Its a crome redraw bug
它是一个crome重绘bug
http://blog.andrewcantino.com/blog/2012/02/15/fixing-the-chrome-background-refresh-bug/
http://blog.andrewcantino.com/blog/2012/02/15/fixing-the-chrome-background-refresh-bug/
have a look on this may be you will get your sloution.
看看这可能是你会得到你的谅解。
#1
48
Finally I have a working workaround .
最后,我有一个工作的解决方法。
Just using outline: 1px solid transparent;
on the div fixes the problem :)
只需使用轮廓:1px实心透明;在div修复问题:)
It's an anti-aliasing issue.
这是一个消除锯齿的问题。
#2
0
Its a crome redraw bug
它是一个crome重绘bug
http://blog.andrewcantino.com/blog/2012/02/15/fixing-the-chrome-background-refresh-bug/
http://blog.andrewcantino.com/blog/2012/02/15/fixing-the-chrome-background-refresh-bug/
have a look on this may be you will get your sloution.
看看这可能是你会得到你的谅解。