Hi i what to make an image of a cookie plus a string of "+1" to appear and dissapear each time the user clicks the cookie image.
Similair to this website: http://orteil.dashnet.org/cookieclicker/
You can find my project here: http://www.chri126g.wigf1.sde.dk/Javascript/cookieclicker2/
Right now when you click the cookie the "cookies" increment with 1, how can i make a cookie appear when clicking? with +1? at the spot where my mouse cusor is aswell ?
Please note that i do not nor will i use jQuery :) so please lets discuss clean vanilla JS :)
您应该:1.在页面加载中加载要显示/隐藏的cookie的图像2.您可以使用jquery之类的库来制作动画,请访问http://api.jquery.com/animate/可以指定持续时间,转换类型等。
You could make the text appear/dissapear with the "onclick" event trigger. If you use jquery you can also animate it like:
$(xxxx).fadeIn(1500).fadeOut(1500);
Use a hidden div with the text and absolute position so you can make it fade in and out.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.