tree_panning_js

   Usages of this macro
... in topic.naml
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
<macro name="tree_panning_js">
    <script type="text/javascript">
        $(document).ready(function() {
            (function() {
                var down = null;
                var initialLeft = null;
                var $area = $('#threaded-contents');
                function startDrag(e) {
                    if (e.target == this) {
                        down = e.pageX;
                        initialLeft = parseInt($area.css('margin-left'));
                        return false;
                    }
                };
                function drag(e) {
                    if (down) {
                        var m = initialLeft + (e.pageX - down);
                        $area.css('margin-left',m > 0? '0' : m+'px');
                    }
                };
                function stopDrag(e){
                    down = null;
                    initialLeft = null;
                };
                $('div.connect-inner,#topic-contents')
                    .mousedown(startDrag)
                    .mousemove(drag)
                    .mouseup(stopDrag);
                $(document).mouseup(stopDrag);
            })();
        });
    </script>
</macro>