该图像是游标Trailimage的静态div副本。一个是固定的,另一个跟随光标。如何编码静态div图像以跟随光标?

引用此图像http://deverexdrawer.deviantart.com/art/Trailimage-538913342

Trailimage JavaScript摘录

var trailimage=["images/contact/gardening-glove-cursor.png", , ]
var offsetfrommouse=[-110,5]
var displayduration=0

if (document.getElementById || document.all)
    document.write('<div id="trailimageid" style="position:absolute;visibility:visible;left:0px;top:100px;width:1px;height:1px"><img border="0" src="'+trailimage[0]+'"></div>')

function followmouse(e){
    var xcoord=offsetfrommouse[0]
    var ycoord=offsetfrommouse[1]
    if (typeof e != "undefined"){
        xcoord+=e.pageX
        ycoord+=e.pageY
}

</script>


静态div图像

...<img border="0" src="'+trailimage[0]+'"
onmousedown="this.src=trailimage[1]"
onmouseup="this.src=trailimage[0]" />...


假设

var trailimage=[
  "images/contact/gardening-glove-cursor.png",
  "images/contact/gardening-glove-cursor_down.png" ]

最佳答案

尝试这个

html

的CSS

javascript

<div id="movingDiv">
    <img id="barber" class="barber-image" src="1.jpg" />
</div>

10-08 11:26