我正在製作在線刮刮卡,我需要知道如何將光標更改爲硬幣。更改光標的外觀
這裏是我已經嘗試了代碼示例:
<div id="krasvak" class="scratchpad"></div>
<style>
#krasvak {
width: 25%;
height: 100px;
border: solid 1px;
display: inline-block;
}
</style>
<script type="text/javascript" src="wScratchPad.js"></script>
<script type="text/javascript">
$('#krasvak').wScratchPad({
cursor: 'cursor: url("images/muntje.png"), auto;',
scratchMove: function (e, percent) {
console.log(percent);
if (percent > 70)
{
this.clear();
window.alert("U heeft uw code gekrast");
window.location.href='compleet.php';
}
}
});
$('#krasvak').wScratchPad('bg', 'images/slide1.png');
$('#krasvak').wScratchPad('fg', 'images/overlay.png');
$('#krasvak').wScratchPad('size', 10);
</script>
這裏是java腳本代碼
$.fn.wScratchPad.defaults = {
size : 5, // The size of the brush/scratch.
bg : '#cacaca', // Background (image path or hex color).
fg : '#6699ff', // Foreground (image path or hex color).
realtime : true, // Calculates percentage in realitime
scratchDown : null, // Set scratchDown callback.
scratchUp : null, // Set scratchUp callback.
scratchMove : null, // Set scratcMove callback.
cursor : 'crosshair' // Set cursor.
};
我真的並欣賞它,如果有人可以幫助我的一部分出。
[爲CSS自定義遊標使用外部圖像]可能的重複(http://stackoverflow.com/questions/18551277/using-external-images-for-css-custom-cursors) – WeSt 2014-09-03 14:24:07
[Custom Cursor Image CSS ](http://stackoverflow.com/questions/336925/custom-cursor-image-css) – pjmorse 2014-09-03 14:27:52