打开模态时执行某些操作

时间:2016-03-17 23:29:47

标签: javascript jquery modal-dialog getuikit

我想在我的模态打开后立即从按钮中删除一个类。我这样做有困难,因为我不知道如何检查模式何时打开。我使用的是uikit,它给出了以下示例:

<div id="offerModal" class="uk-modal">
    <div class="uk-modal-dialog uk-modal-dialog-blank">...</div>
</div>

我的模态如下:

private static SerialPort port1 = SerialPort.getCommPort("COM5");
private static SerialPort port2 = SerialPort.getCommPort("COM3");

public static void main(String[] args){ 
    if(port1.openPort())System.out.println("Connected to Port 1 on COM5");
    else System.out.println("Could not connect to Port 1 on COM5");
    if(port2.openPort())System.out.println("Connected to Port 2 on COM3");
    else System.out.println("Could not connect to Port 2 on COM3");
    Scanner scanner = new Scanner(port1.getInputStream());
    Thread readThread = new Thread(){
        @Override
        public void run(){
            while(scanner.hasNextLine()){
                System.out.println("Has Next");
            }
        }
    };
    readThread.start();
}   

1 个答案:

答案 0 :(得分:1)

这样的事情可以帮到你:

$('.modalSelector').on({

    'show.uk.modal': function(){
        console.log("Modal is visible.");
        $('.btn').removeClass('abc');
    },

    'hide.uk.modal': function(){
        console.log("Element is not visible.");
    }
});