Giter VIP home page Giter VIP logo

pintu-game's Introduction

/*******************************************************
 *@ Name: HTML5拼图游戏
 *@ Time: 2015/5/5
 *@ Author: FrontEndZQ
*/

一、注意事项
1、基于Jquery 开发;
2、引用interactJS插件,通过dropzones功能改写开发;
3、图片预加载引用imagesloaded.min.js; 
4、移动适配,引用viewport.js;


二、结构说明
1、选择图片模板
2、点击确认按钮,进入拼图游戏
3、优雅的计时器


三、核心代码解析
存放块:<span class="dropzone g1" id="drop1"></span>
拖拽块:<img class="js-drag" id="drag7" src="images/pk/modea07.png" />

通过调用方法:setupDropzone('#drop1', '#drag1');达到拖拽与吻合的目的。

移动正确,将当前图片添加到对应的存放块中,并删除原拖拽块中的图片;
event.target.innerHTML= '<img class="addImg" id="a'+event.relatedTarget.id+'" src="'+a.src+'" alt="" />';
event.relatedTarget.parentNode.removeChild(event.relatedTarget);
移动错误,则原路弹回; 

具体效果见源码!

如有问题或建议,请邮件至:[email protected]

pintu-game's People

Contributors

frontendroad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.