Home JS special effects jQuery effects jQuery mobile WeChat claw machine game code

jQuery mobile WeChat claw machine game code

jQuery mobile WeChat claw machine game code

jQuery mobile WeChat claw machine game code

js code

<script>
window.onload=function(){
var k=0;//can be clicked
var c=0;//doll’s
scrollLeft();//Doll scroll
var talon=$(".pawerPic").offset().left+55//First get the position of the paw (here is fixed)
console.log(talon)
/*Declare variables*/
var areaHeight=$("body").height()-150//Height of active area
var long=areaHeight-115//The distance the claws extend (the current height of the doll is tentatively set at 115px;)
/*Assign a value to the height of the active area*/
$(".area").css({height:areaHeight})
/*Doll scroll*/
function scrollLeft(){
var speed=20;
var yu=$("#sel1").html();
$("#sel2").html(yu);
function Marquee(){
c++
if($("#sel2").width()-$("#pack").scrollLeft()<=0){
c=0
$("#pack").scrollLeft(c);
}else{
$("#pack").scrollLeft(c);
}
}//Marquee ends
var timer=setInterval(Marquee,speed);
/*Click the button*/
$(".btn_star").bind('touchstart',function(){
$(this).css({display:"none"})//Simple button style
$(".pawer").animate({height:long},2000);//Stretch down (rope)
$(".pawerPic").animate({top:long+20},2000);//Stretch down (paw)
/*Caught the doll*/
function fn(t_img){
$(".pawerPic").addClass("on");
$(".win img").attr("src",t_img)
};
/*The doll disappears*/
function end(){
$(".pawerPic").removeClass("on")
}
/*Button click*/
function btn(){
$(".btn_star").css({display:"block"})
}//Control whether the button can be clicked
/*Determine whether the doll has been caught*/
if_ok=setTimeout(ok_no,2000);
function ok_no(){
/*Print out the position of each doll at this moment*/
for(var i=0;i<$("#pack img").length;i++){
var l=$("#pack img").eq(i).offset().left+41.61//The position of each doll at this moment
if(l-20<=talon&&talon<=l+20){
alert("You caught shit")
var t_img=$("#pack img").eq(i).attr("src")
time_zz=setTimeout(fn(t_img),0)
return
}
/*Then compare with the position of the paw*/
console.log("No shit caught")
					
}
}
/*Event call*/
//time_zz=setTimeout(fn,2000);//Caught the doll
time_xs=setTimeout(end,4000);//The doll disappears
time_ww=setTimeout(btn,4000);//Button click
$(".pawer").animate({height:20},2000);//Retract (rope)
$(".pawerPic").animate({top:40},2000);//Retract (paw)
})
}//scrollLeft ends
}//window.onload ends
</script>
This is a jQuery mobile WeChat claw machine game code that is easy to expand and fun to use. Download the source code of the claw machine WeChat mini game.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

How to set delay in jquery How to set delay in jquery

26 Apr 2023

In front-end development, we often need to use jQuery to handle some interactive effects and animation effects, such as animation effects when the mouse is hovering, animation effects when the page is loading, etc. But sometimes we need to set a delay time so that these effects can be better expressed. So, how does jQuery set a delay? This article will introduce this issue in detail. 1. Delay method in jQuery In jQuery, delay effect can be easily achieved by using the delay() method. The delay() method can be used

Experience in developing Widgets based on jQuery UI CSS Framework_jquery Experience in developing Widgets based on jQuery UI CSS Framework_jquery

16 May 2016

jQuery UI CSS Framework is a style framework in jQuery UI. You can use jQuery Theme roller to generate the css style effects you want. We can use some frameworks of jQuery UI to develop plug-ins based on jQuery UI CSS Framework effects.

jQuery's animate function realizes image and text switching animation effect_jquery jQuery's animate function realizes image and text switching animation effect_jquery

16 May 2016

animate() is a method in jquery that can be used to create animation effects. The animate() method in jquery adds good visual effects to that page.

jquery typing effects stop deleting jquery typing effects stop deleting

23 May 2023

With the popularity of the Internet, the application of typing effects is becoming more and more widespread, and jquery typing effects have become the first choice of many website developers. However, in the process of realizing this special effect, detailed issues often affect the user experience, such as the problem of deletion of typing special effects. This article will introduce how to use jquery typing effects to stop deletion and improve the user's browsing experience. The implementation of jquery typing effects can use ready-made plug-ins, such as typed.js and jQuery.Typewriter. These plug-ins are based on jquery

Jquery timeline effects (three different types)_jquery Jquery timeline effects (three different types)_jquery

16 May 2016

This article collects three different types of jquery timeline effects for everyone, involving jquer related knowledge. Friends who are interested in jquery timeline effects can refer to this article.

Beautiful jquery prompt effect (imitation of Tencent pop-up layer)_jquery Beautiful jquery prompt effect (imitation of Tencent pop-up layer)_jquery

16 May 2016

There are many jquery prompt effects. This article also provides a super beautiful pop-up layer effect imitating Tencent. If you love special effects, don’t miss it. I hope the cases provided in this article will be helpful for you to learn jquery special effects.

What are the animation effects in jQuery? What are the animation effects in jQuery?

28 Nov 2018

Animation effects in jQuery include: slideDown, slideUp, etc. to achieve sliding effects; fadeIn, fadeToggle, etc. to achieve fade-in and fade-out effects.

How to write animation in jquery How to write animation in jquery

28 May 2023

jQuery is a powerful JavaScript library that greatly simplifies the work of developers and designers. Among them, Jquery’s animation effect has become one of the most important elements in design. This article will introduce how to use jQuery to create animation effects. 1. jQuery animation effects jQuery animation effects are generally implemented using the animate() function. It allows programmers to create transition animations on one or more CSS properties. animate() function requires

jQuery animation special effects example tutorial_jquery jQuery animation special effects example tutorial_jquery

16 May 2016

This article mainly introduces jQuery animation special effects, and describes in detail the implementation method of jQuery animation special effects. It is very practical. Friends who need it can refer to it.

See all articles See all articles

Hot Tools

jQuery2019 Valentine's Day Confession Fireworks Animation Special Effects

jQuery2019 Valentine's Day Confession Fireworks Animation Special Effects

A very popular jQuery Valentine's Day confession fireworks animation special effect on Douyin, suitable for programmers and technical geeks to express their love to the girl they love. No matter you choose to be willing or not, you have to agree in the end.

layui responsive animated login interface template

layui responsive animated login interface template

layui responsive animated login interface template

520 Valentine's Day confession web animation special effects

520 Valentine's Day confession web animation special effects

jQuery Valentine's Day Confession Animation, 520 Confession Background Animation

Cool system login page

Cool system login page

Cool system login page

HTML5 tape music player-CASSETTE PLAYER

HTML5 tape music player-CASSETTE PLAYER

HTML5 tape music player-CASSETTE PLAYER