可拖动网格图片插件-DRAGGABLE IMAGE BOXES GRID

所属分类:输入-拖和放

 38346  324  查看评论 (2)
分享到微信朋友圈
X
可拖动网格图片插件-DRAGGABLE IMAGE BOXES GRID ie兼容6

今天我要给大家介绍的是一款全屏图片网格插件。我们可以用鼠标来拖动图片网格的可视区平滑移动。当我们点击某张图片的时候,该图片会全屏放大以供用户查看。


使用步骤

1、引入以下的js和css文件

<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.tmpl.min.js"></script>
<script type="text/javascript" src="js/jquery.kinetic.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>


2、在head标签中加入以下js代码,由于JS代码比较多,所以只截取了其中一部分,完整的代码可参见Demo源码

<script type="text/javascript">
 $(function() {
    var $ibWrapper = $('#ib-main-wrapper'),
    Template= (function() {
    // true if dragging the container
    var kinetic_moving = false,
    // current index of the opened item
    current = -1,
    // true if the item is being opened / closed
    isAnimating = false,
    // items on the grid
    $ibItems = $ibWrapper.find('div.ib-main > a'),
    // image items on the grid
    $ibImgItems = $ibItems.not('.ib-content'),
    // total image items on the grid
    imgItemsCount = $ibImgItems.length,
    init = function() {
         // add a class ib-image to the image items
         $ibImgItems.addClass('ib-image');
         // apply the kinetic plugin to the wrapper
         loadKinetic();
         // load some events
         initEvents();
     },
   ................
     });
</script>


3、在body标签中加入以下格式的html代码

<div id="ib-main-wrapper" class="ib-main-wrapper">
     
    <div class="ib-main">
        <a href="#"> <img src="images/large/1.jpg" data-largesrc="images/large/1.jpg" alt="image01"> <span>Crabbed Age and Youth</span> </a> <a href="#"> <img src="images/large/2.jpg" data-largesrc="images/large/2.jpg" alt="image02"> <span>Cannot live together</span> </a> <a href="#" class="ib-content">
        <div class="ib-teaser">
             
            <h2>
                Welcome <span>Howdy, Stranger</span>
            </h2>
 
        </div>
 
        <div class="ib-content-full">
            <!-- Some content -->
        </div>
</a> ...
    </div>
 
</div>	


其它的我就不多介绍了,大家有兴趣可以自己去了解。

相关插件-拖和放

拖放交互的想法

在UI中拖放交互的一些想法,这个想法是显示一个可拖拽的区域,代表一个元素被拖拽后的某些动作。
  拖和放
 25667  344

jQuery自由拖曳照片插件

可自由拖曳照片,并展现文字和内容
  拖和放
 26740  324

基于H5的拖拽功能

基于H5的拖拽功能,再用jQuery进行了功能完善,拖动后根据放置的位置来布局。
  拖和放
 42177  359

图标拖拽效果,兼容所有浏览器

原生JS实现图标图片拖拽,封装好了,可以直接拿去使用
  拖和放
 37709  373

讨论这个项目(2)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    在地球上旅行的独角兽 ζ 0
    2018/12/11 9:50:11
    怎么初始换个位置 回复
        0
    2018/11/1 13:37:05
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复