开发者

Create a draggable sortable effect like that of BBC

I want to create draggable and sortable effect like that of http://www.bbc.co.uk/.

For that I used Jquery UI and got kinda same effect.

But with complications, if you see the effect in BBC's website, when you pick a division there appears a shadow with a dotted line below it and the shifting between the boxes is pretty much different that I get.

When using the Jquery UI, I floated the <li> to appear them on side by side to each other, but when I am shifting the boxes, the shifting box gets inserted in between the boxes.

Here is my coding so far. But it is not that of BBC

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link type="text/css" href="themes/base/jquery.ui.all.css" rel="stylesheet" />
    <script src="js/lib/jquery.js"></script>
    <script src="js/lib/ui.js"></script>
    <script src="js/lib/widget.js"></script>
    <script src="js/lib/utilities/mouse.js"></script>
    <script src="js/lib/interactions/draggable.js"></script>
    <script src="js/lib/interactions/sortable.js"></script>    
    <style>
        * { margin:0;padding:0; }
        body {
            background:url(themes/default/images/background.gif);
            font-family:Verdana, Geneva, sans-serif;
            font-size:12px;
        }
        #wrapper {
            width:980px;
       开发者_C百科     margin: 0 auto;
            border:1px #F00 solid;
        }
        .sublayout {
            width:300px;
            height:300px;
            background:#aeadad;
            border:1px #2495f5 solid;
            float:left;
            margin:1em;
            -moz-box-shadow: 0 0 20px black;
            -webkit-box-shadow: 0 0 20px black;
            box-shadow: 0 0 20px black;         
        }
    </style>
    <script type="text/javascript">
    $(function() {
        $("#sortable").sortable({
            revert: true
        });
        $("#draggable").draggable({
            connectToSortable: '#sortable',
            helper: 'clone',
            revert: 'invalid'
        });
        $("ul, li").disableSelection();
    });
    </script>    
</head>

<body>
    <div id="wrapper">       
        <ul id="sortable">
            <li class="ui-state-default sublayout">Item 1</li>
            <li class="ui-state-default sublayout">Item 2</li>
            <li class="ui-state-default sublayout">Item 3</li>
            <li class="ui-state-default sublayout">Item 4</li>
            <li class="ui-state-default sublayout">Item 5</li>
        </ul>    
    </div>
</body>
</html>


I think you need 3 lists (columns) to created this kind of effect. Have a look at this demo: http://jqueryui.com/demos/sortable/#portlets

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜