代码之家  ›  专栏  ›  技术社区  ›  gene

如何为kendo.Window()指定自定义css类?

  •  1
  • gene  · 技术社区  · 6 年前

    我建立了kendoWindow,需要为它的标题创建自定义类,所以我不使用telerik提供的公共类。

    $("#win").kendoWindow({
        visible: false,
        modal: true,
        title: true,
        open: function (e) { $("html, body").css("overflow", "hidden"); },
        close: function (e) { $("html, body").css("overflow", ""); },
        draggable: false,
        width: 950,
        height: 510,
        position: {
            top: 100,
            left: 500
        },
        resizable: false
    }); 
    

    它生成以下html:

    enter image description here

    k-window-titlebar k-header

    我怎么能做那样的事?

    1 回复  |  直到 6 年前
        1
  •  1
  •   JKimbrough    6 年前

    下面是如何在Kendo UI中自定义任何CSS类:

    //You need to first make sure the window is initialized - if you are not using Kendo wrappers 
    
    $("#myWindow").kendoWindow({
      // put your settings here
    });
    
    // Now you can add a custom CSS class after window initialization
    
    var winObject = $("#myWindow").data("kendoWindow");
    winObject.wrapper.addClass("myCustomClass");
    
    // Here you can add a custom CSS class in the open event handler
    
    function onWindowOpen(e) {
        e.sender.wrapper.addClass("myCustomClass");
    }