gpt4 book ai didi

jquery - 需要关于圆 Angular jquery 插件的建议

转载 作者:技术小花猫 更新时间:2023-10-29 11:36:12 25 4
gpt4 key购买 nike

我想学习jquery插件,所以我决定尝试做一个简单的圆 Angular 框。我知道那里已经有一些圆 Angular 插件,但这对我来说更像是一种学习练习,而不是工作要求。

我从 here 中取出的圆 Angular .我喜欢这个示例,因为它不使用图像,可以很容易地更改框的颜色。

我想我很难想出最好的方法来做到这一点。我有一个非常粗略的样本,可以正常工作,但感觉不对。困扰我的部分是围绕内容区域构建圆 Angular 。现在它使用“内容”框并在其周围附加 Angular 。有什么更好的方法可以做到这一点?

这里是制作方框的调用 - $('#content').roundbox();

如果这还不够,请告诉我。

//
(function($)
{
jQuery.fn.roundbox = function(options)
{

var opts = $.extend({}, $.fn.roundbox.defaults, options);

var outer = $("<div>");
var topBorder = $("<b class='xtop'><b class='xb1'></b><b class='xb2'></b><b class='xb3'></b><b class='xb4'></b></b>");
var bottomBorder = $("<b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b>");
var title = $("<h1>Select Funding</h1>");
var separator = $("<div></div>");

$(this).append(title);
$(this).append(separator);

var firstElement = $(this).children()[0];
if (firstElement != null)
{
title.insertBefore(firstElement);
separator.insertBefore(firstElement);
}

outer.append(topBorder);
outer.append($(this));
outer.append(bottomBorder);

$("#fundingAdminContainer").append(outer);


//Add classes
outer.addClass(opts.outerClass); //outer container
$(this).addClass(opts.contentClass); //inner content
title.addClass(opts.titleClass); //roundbox title
separator.addClass(opts.lineClass); //line below title
};

$.fn.roundbox.defaults =
{
outerClass: 'roundbox',
contentClass: 'roundboxContent',
titleClass: 'roundboxTitle',
lineClass: 'roundboxLine'
};


})(jQuery);


//CSS
.roundbox
{
float:left;
width:400px;
margin-right:20px;
}

.roundboxContent
{
display:block;
background:#ffffff;
border:0 solid #D4E2FE;
border-width:0 1px;
height:180px;
padding:10px;
}

.roundboxLine
{
background: url(../images/fundingAdmin_line.gif);
background-repeat:no-repeat;
height:5px;
}

.roundboxTitle
{
font-size:1.3em; color:#17A2D3;
}

.xtop, .xbottom {display:block; background:transparent; font-size:1px;}
.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;}
.xb1, .xb2, .xb3 {height:1px;}
.xb2, .xb3, .xb4 {background:#ffffff; border-left:1px solid #D4E2FE; border-right:1px solid #D4E2FE;}
.xb1 {margin:0 5px; background:#D4E2FE;}
.xb2 {margin:0 3px; border-width:0 2px;}
.xb3 {margin:0 2px;}
.xb4 {height:2px; margin:0 1px;}

盒子的最终结构应该是:

<div id="fundingAdminContainer"><!-- Not part of rounded box, just serves as a container. -->
<div class="roundbox">
<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
<div id="content" class="roundboxContent">
<h1 class="roundboxTitle">Title</h1>
<div class="roundboxLine"></div>
//CONTENT
</div>
<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>
</div>
</div>

最佳答案

http://www.curvycorners.net/ http://www.curvycorners.net/

javascript 库,不是 jQuery 插件,但它似乎可以工作 :D

关于jquery - 需要关于圆 Angular jquery 插件的建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1020694/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com