简体   繁体   中英

How to make a Modal Window not movable?

I would like a modal Window but NOT movable, and couldn't find any information about this behavior in document. How do I disable it?

Currently you can use Client Side Programming to customize a not movable modal (overlapped, popup) window, the sample below create two overlapped window and make one of them not movable

<zk xmlns:w="client">
    <window title="center win, movable" border="normal"
        position="center,center"
        onCreate="self.doOverlapped();" />
    <window title="top win, not movable" border="normal"
        sclass="z-window-not-movable"
        position="center,top"
        onCreate="self.doOverlapped();">
        <attribute w:name="bind_"><![CDATA[
            function (a, b, c) {
                if (!this.$class.ignoremoveOverridden) {
                    this.$class.ignoremoveOverridden = true;
                    var oldImove = this.$class._ignoremove;
                    this.$class._ignoremove = function (dg, pointer, evt) {
                        var wgt = dg.control;
                        if (jq(wgt.$n()).hasClass('z-window-not-movable')) {
                            return true;
                        }
                        return oldImove.apply(wgt, arguments);
                    }
                }
                this.$bind_(a, b, c);
            }
        ]]></attribute>
    </window>
</zk>

References:

Window.js

ZK Client Side Programming

If a Window has no header (no title, close button, ...) you can not move it.
If you want/need the head element, I am pretty sure thre is no build in way
to disable the movement. But I am interested in this too and I think this should
be added to zk tracker as a feature.
I will take a more detailed look at the Window component and if I find a way
to disable it, I will add this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM