react-draggable实现拖动图片排列效果代码

代码语言:html

所属分类:拖放

代码描述:react-draggable实现拖动图片排列效果代码

代码标签: react-draggable 拖动 图片 排列

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  




  <meta name="viewport" content="width=1024">
<meta name="apple-mobile-web-app-capable" content="yes">

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.15.4.2.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-dom.15.4.2.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/browser.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/fetch.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-draggable.min.js"></script>
  
  
<style>
@import url('https://fonts.googleapis.com/css?family=Schoolbell');

[draggable] {
  cursor: move;
}

.dragndrop {
  text-align: center;
  font-size: 1.25em;
  z-index: -1;
}

.parts-drawer {
  background-color: #eee;
  height: 23em;
  width: 200%;
}

/* Speech Bubbles */

body,
html,
div.board,
div#react-container {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Schoolbell', cursive;
    font-weight: 400;
    font-size: 1em;
    line-height: 1.2em;
    color: #fff;
    background-color: #6DA7F5;
} 

#outer {        
   display: inline;
}

h1 {
   text-align: center;
   font-size: 2.6em;
   font-weight: 400;
   line-height: 1.0em;
   color: #C49510;
}

h2 {
   font-family: 'Schoolbell', cursive;
   font-weight: bold;
   font-size: 1.6em;
}

h1 {
   text-shadow: 1px 1px 1px rgb(221, 222, 229);
   margin: 20px 0;
}

#h1-span {
   font-size: 0.7em; 
   text-shadow: 1px 1px 1px rgb(100, 100, 100);
}

#header h2 {
   text-align: center;
}

#lynda-link {
   font-family: 'Schoolbell', cursive;
   font-size: 0.9em;
   float: right;
   margin: -40px 40px 0 0;
}

div.board {
    background-color: 'brown';
    width: 100%;
    background: #fff;
}

div.note {
    height: auto;
    width: auto;
    max-width: 180px;
    margin: 2px 0;
    position: absolute;
  z-index: 100;
    cursor: -webkit-grab;
    overflow: hidden;
    padding: 1em 3em;
    
}

div.note:active {
    cursor: -webkit-grabbing;
}

div.note p {
    margin: 0;
    font-size: 16px;
    padding: 5px;
    font-family: 'Schoolbell', cursive;
    line-height: 1.1;
  color: #000;
}

div.note:hover > span {
    opacity: 1;
}

div.note > span {
    position: absolute;
    bottom: 2px;
    right: 2px;
    opacity: 0;
    transition: opacity .25s linear;
}

div.note button {
    margin: 2px;
}

div.note textarea {
    height: 75%;
    background: rgba(255, 255, 255, .5);
}

.board > button {
    position: fixed;
    top: 5em;
    right: 1em;
    font-size: 1em;
    padding: .8em .8em 1em .8em;
    border-radius: 100px;
    border: 0px solid;
    background-color: #75B1FE;
    color: #fff;
    font-family: 'Schoolbell', cursive;
}

img {width: 100px;}

img .bigger {transform: scale(2);}
</style>



</head>

<body  >
  <!-- I do not own any of the Webcomicname comics. I just used a few different pens to throw this thing together for myself. -->


<p class="dragndrop">Drag and Drop to Make a Comic</p>
<div class="parts-drawer"></div>
  
<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/7tK6z3mS_o.jpg" alt="eyes1" id="image" style="position: absolute; left: 1em; top: 5em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/FsXMTB2a_o.jpg" alt="eyes2" id="eyes2" style="position: absolute; left: 1em; top:12em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/Zjcsij3B_o.png" alt="eyes3" id="eyes3" style="position: absolute; left: 1em; top: 19em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/SAhvoaTo_o.jpg" alt="eyes4" id="eyes4" style="position: absolute; left: 8em; top: 5em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/Iw7zLLRW_o.png" alt="eyes5" id="eyes5" style="position: absolute; left: 8em; top: 12em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/OrVJvOAw_o.png" alt="mouth1" id="mouth1" style="position: absolute; left: 8em; top: 19em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/mBXyXGCj_o.jpg" alt="mouth3" id="mouth3" style="position: absolute; left: 15em; top: 5em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/Gib0AyBP_o.png" alt="mouth4" id="mouth4" style="position: absolute; left: 15em; top: 12em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/LL5EyqYv_o.png" alt="mouth5" id="mouth5" style="position: absolute; left: 15em; top: 19em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/2ZTGKq9g_o.jpg" alt="nose1" id="nose1" style="position: absolute; left: 22em; top: 5em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/yQdHMpj3_o.jpg" alt="nose2" id="nose2" style="position: absolute; left: 29em; top: 5em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/DSblekOI_o.jpg" alt="nose3" id="nose3" style="position: absolute; left: 22em; top: 12em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/9KwfmGj8_o.png" alt="nose4" id="nose4" class="part" style="position: absolute; left: 22em; top: 19em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/wYLJNq1K_o.png" alt="nose5" id="nose5" style="position: absolute; right: .5em; top: 10em; z-index: 5;">

<img draggable="true" src="//repo.bfw.wiki/bfwrepo/images/universe/b1yxUl9t_o.png" alt="mouth2" id="mouth2" style="position: absolute; right: .5em; top: 15em; z-index: 5;">
  

<!-- Speech Bubbles -->

<div id="outer">
    <div id="react-container">
    </div>
</div>
<script type="text/babel">
    var Note = React.createClass({
        getIn.........完整代码请登录后点击上方下载按钮下载查看

网友评论0