Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui jQuery如何添加portlet_Jquery Ui_Portlet - Fatal编程技术网

Jquery ui jQuery如何添加portlet

Jquery ui jQuery如何添加portlet,jquery-ui,portlet,Jquery Ui,Portlet,如何将jQueryUIportlet添加到现有的一组Portlet中 (勾选:) 如何在加载后添加portlet 在我的个人项目中,我实现了Portlet: 我想制作一个按钮来附加一个portlet。我尝试将其附加到.column,但CSS没有加载(当然),当您添加.addClass时,所有其他portlet也会受到影响。一定有一个简单的方法…但是如何呢?目前,你正在做 $(".portlet").addClass("ui-widget ui-widget-content ui-helper-c

如何将jQueryUIportlet添加到现有的一组Portlet中

(勾选:)

如何在加载后添加portlet

在我的个人项目中,我实现了Portlet:
我想制作一个按钮来附加一个portlet。我尝试将其附加到.column,但CSS没有加载(当然),当您添加.addClass时,所有其他portlet也会受到影响。一定有一个简单的方法…但是如何呢?

目前,你正在做

$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend('<span class="ui-icon ui-icon-minusthick"></span>')
.end()
.find(".portlet-content"); 

现在,你在做什么

$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend('<span class="ui-icon ui-icon-minusthick"></span>')
.end()
.find(".portlet-content"); 

创建几个portlet之后,使用类addspace添加最后一个div

然后使用.replaceWith和.addClass创建一个函数

$('.addspace').replaceWith(html);
返回的HTML示例:

<div class="portlet" id="portletname"> <!-- make sure portletname is unique -->
<div class="portlet-header">test</div>
<div class="portlet-content">test</div>
</div>

<!-- New addspace (replaceWith replaces the old one)  -->
<div class="addspace" >
</div

测试
测试

创建几个portlet之后,使用类addspace添加最后一个div

然后使用.replaceWith和.addClass创建一个函数

$('.addspace').replaceWith(html);
返回的HTML示例:

<div class="portlet" id="portletname"> <!-- make sure portletname is unique -->
<div class="portlet-header">test</div>
<div class="portlet-content">test</div>
</div>

<!-- New addspace (replaceWith replaces the old one)  -->
<div class="addspace" >
</div

测试
测试

当您
.addClass
时,会发生什么情况?你能在你的页面上取消注释,这样我们就可以看到错误了吗?(当我在添加新div后执行代码时,其他portlet不会受到影响。)顺便说一下,很好的注释,只有第一个有点苛刻。所有其他portlet都有一个减号(-),用于最小化。谢谢你的补充,忘记了第一个:)。删除了注释星号。当您
.addClass
时会发生什么?你能在你的页面上取消注释,这样我们就可以看到错误了吗?(当我在添加新div后执行代码时,其他portlet不会受到影响。)顺便说一下,很好的注释,只有第一个有点苛刻。所有其他portlet都有一个减号(-),用于最小化。谢谢你的补充,忘记了第一个:)。删除了注释星。但是现在您的portlet被困在addspace中。您将无法添加第二个…已解决。首先替换,然后是addClass。但是现在您的portlet被困在addspace中。您将无法添加第二个…已解决。首先替换,然后添加类。