Download the jquery extension wScratchPad.js. The original page cannot be opened. I provide a download address wScratchPad-2.1.0.zip
Then (calm down), some unscrupulous bloggers directly repost other people’s articles, skipping the verification process. They should be fooling you and not a novice. Let me correct it here
In this extension, how can I pass the area scratched by the user
Copy code The code is as follows:
$("#wScratchPad3").wScratchPad({
cursor:'' , //Set the mouse style
color:'gray' , //Set the color of the overlay, which is mutually exclusive with the image2 function
width: "300",
height: "100",
image: "" //The top image
// For more configuration-related options, please see the source code
scratchUp: function(e, percent){
if(percent > 60)
{
alert("sss");
}
}
});
From the above code, it can be seen that this is different from the so-called tutorials on the Internet. The function used to obtain the scraped range here is not
scratchMove()
instead of
scratchUp()
Why? See source code
Copy code The code is as follows:
scratchFunc: function(e, $this, event)
{
e.pageX = Math.floor(e.pageX - $this.canvas_offset.left);
e.pageY = Math.floor(e.pageY - $this.canvas_offset.top);
$this[' scratch' + event](e, $this);
if(this.settings.realtimePercent || event == "Up") {
if($this.settings['scratch' + event]) $ this.settings['scratch' + event].apply($this, [e, $this.scratchPercentage($this)]);
Here this gets the UP of the function binding instead of move
http://www.bkjia.com/PHPjc/781412.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/781412.htmlTechArticleDownload the jquery extension wScratchPad.js. The original page cannot be opened. I provide a download address wScratchPad-2.1 here. .0.zip Then (calm down), some unscrupulous bloggers directly forward other people’s...