0

Drag And Drop To Columnsスクリプトを検索すると、これが見つかりました

http://www.dhtmlgoodies.com/index.html?showDownload=true&whichScript=drag_drop_nodes

移動するアイテムに強調表示された色を追加しようとしています

cssコードを追加します

<style type="text/css">
.highlight {
    background-color: #fff34d;
}
</style>

これをJavaScriptで変更します

    function initDragDropScript() {
        dragContentObj = document.getElementById('dragContent');
        dragDropIndicator = document.getElementById('dragDropIndicator');
        dragDropTopContainer = document.getElementById('dhtmlgoodies_dragDropContainer');
        document.documentElement.onselectstart = cancelEvent;;
        var listItems = dragDropTopContainer.getElementsByTagName('LI'); // Get array containing all <LI>
        listItems.className = 'highlight';
        var itemHeight = false;
        for (var no = 0; no < listItems.length; no++) {
            listItems[no].onmousedown = initDrag;
            listItems[no].onselectstart = cancelEvent;
            if (!itemHeight) itemHeight = listItems[no].offsetHeight;
            if (MSIE && navigatorVersion / 1 < 6) {
                listItems[no].style.cursor = 'hand';
            }
        }
        var mainContainer = document.getElementById('dhtmlgoodies_mainContainer');
        var uls = mainContainer.getElementsByTagName('UL');
        itemHeight = itemHeight + verticalSpaceBetweenListItems;
        for (var no = 0; no < uls.length; no++) {
            uls[no].style.height = '480 px';
        }

        var leftContainer = document.getElementById('dhtmlgoodies_listOfItems');
        var itemBox = leftContainer.getElementsByTagName('UL')[0];
        document.documentElement.onmousemove = moveDragContent; // Mouse move event - moving draggable div 
        document.documentElement.onmouseup = dragDropEnd; // Mouse move event - moving draggable div 
        var ulArray = dragDropTopContainer.getElementsByTagName('UL');
        for (var no = 0; no < ulArray.length; no++) {
            ulPositionArray[no] = new Array();
            ulPositionArray[no]['left'] = getLeftPos(ulArray[no]);
            ulPositionArray[no]['top'] = getTopPos(ulArray[no]);
            ulPositionArray[no]['width'] = ulArray[no].offsetWidth;
            ulPositionArray[no]['height'] = ulArray[no].clientHeight;
            ulPositionArray[no]['obj'] = ulArray[no];
        }

        if (!indicateDestionationByUseOfArrow) {
            indicateDestinationBox = document.createElement('LI');
            indicateDestinationBox.id = 'indicateDestination';
            indicateDestinationBox.style.display = 'none';
            document.body.appendChild(indicateDestinationBox);
        }
    }

しかし、それは何の提案も働いていません

4

0 に答える 0