9

I am trying to make panels which are draggable, resizable, collapsible, closable and can be maximised and minimized as well as follows.

I also want a scroll for the portlet content, if resizing overflows the content. When I set overflow:auto the scroll comes even if the content is not overflowing.

.portlet {
    position: absolute;
    overflow:auto !important;
}

you can have look over my code and demo here panel code
Any help will be appreciated. Thanks in advance!!

2
  • 3
    your design is fluid design so it change on resizing the size of browser ...and for that there is no need to use scroll bar Commented Dec 14, 2012 at 7:10
  • its not a fluid design..i have not used media queries or any such responsive feature Commented Dec 14, 2012 at 8:18

3 Answers 3

1

I dug around and found this Tutorial-Create a Windows-like Interface with jQuery UI

here is the jsFiddle and the code-

  var _init = $.ui.dialog.prototype._init;
    $.ui.dialog.prototype._init = function() {
        _init.apply(this, arguments);

        var dialog_element = this;
        var dialog_id = this.uiDialogTitlebar.next().attr('id');

        this.uiDialogTitlebar.append('<a href="#" id="' + dialog_id + 
        '-minbutton" class="ui-dialog-titlebar-minimize ui-corner-all">'+
        '<span class="ui-icon ui-icon-minusthick"></span></a>');

        $('#dialog_window_minimized_container').append(
            '<div class="dialog_window_minimized ui-widget ui-state-default ui-corner-all" id="' + 
            dialog_id + '_minimized">' + this.uiDialogTitlebar.find('.ui-dialog-title').text() + 
            '<span class="ui-icon ui-icon-newwin"></div>');

        $('#' + dialog_id + '-minbutton').hover(function() {
            $(this).addClass('ui-state-hover');
        }, function() {
            $(this).removeClass('ui-state-hover');
        }).click(function() {
            dialog_element.close();
            $('#' + dialog_id + '_minimized').show();
        });

        $('#' + dialog_id + '_minimized').click(function() {
            $(this).hide();
            dialog_element.open();
        });
    };

        $(document).ready(function() {
            $('#create_button').button().click(function() {
                var create_dialog = $('#dialog_window_1');
                var create_button = $(this);
                if( create_dialog.dialog('isOpen') ) {
                    create_button.button('option', 'label', 'Create a new Window');
                    create_dialog.dialog('close');
                } else {
                    create_button.button('option', 'label', 'Close Window');
                    create_dialog.dialog('open');
                }
            });

            $('#dialog_window_1').dialog({
                width: 'auto',
                height: 'auto',
                autoOpen : false,
                buttons: [
                    {
                        text: 'Create',
                        click: function() {
                            var div_count = $('.dialog_window').length + 1;
                            var div_id = 'dialog_window_' + div_count;
                            var div_title = $('#new_window_title').val();
                            var div_content = $('#new_window_content').val();
                            var buttons = new Array();
                            if( $('#alertbutton').is(':checked') ) {
                                buttons.push({
                                    text: 'ALERT',
                                    click: function() {
                                        alert('ALERTING from Dialog Widnow: ' + div_title);
                                    }
                                });
                            }

                            if( $('#closebutton').is(':checked') ) {
                                buttons.push({
                                    text: 'CLOSE',
                                    click: function() {
                                        $('#' + div_id).dialog('close');
                                    }
                                });
                            }

                            $('body').append('<div class="dialog_window" id="' + div_id + '">' + div_content + '</div>');

                            var dialog = $('#' + div_id).dialog({
                                width: 'auto',
                                height: 'auto',
                                title : div_title,
                                autoOpen : true,
                                buttons: buttons
                            });
                        }
                    }
                ]
            });
            $('#buttonlist').buttonset();
        });`
Sign up to request clarification or add additional context in comments.

Comments

0

Change your css code to the following.

.portlet {
    position: absolute;
}
.portlet-content {
    overflow:auto !important;
}

1 Comment

did the changes...still not working..demo is here panel demo @Doehl
0

The thing that is causing the scrollbars in your jsFiddle is the ui-resizable-handle elements.

Adding these CSS statements should remove the scrollbars until they are needed and doesn't seem to affect the drag handle's functionality

.ui-resizable-s { bottom: 0 !important }
.ui-resizable-e { right: 0 !important }

Here is an updated jsFiddle

As an aside. Although they seem to behave better if you remove the jquery stylesheet link you had in the jsFiddle HTML area, removing it alters their starting positions. So I've left it in with the expectation that it works correctly for you in your actual code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.