打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Transcorners — Cornerus Pride is there *scared*

Transcorners (4 kb)

Assemble! You all know nifty corners, huh? Meet Transcorners - the guys who will round your corners on mootools.

Download
Brought to you by Inviz

Daddy, why transcorners?

  1. No images
  2. Any radius
  3. Transitions support

But... they dont yet support:

  1. image-backgrounds (sorta)
  2. borders with width more then 1px

How does it assemble?

Well, Nifty technogy is used. There are small stripes appending inside of an element which create an illusion of transcorn.

But there are some differences between Nifty and Transcorners:

  • Transcorners always try to have the transcornered element size and original element size the same. That means, no (almost) jumping you will notice after stuff will be done. So if you will need to shift corners, you will need to set padding.
  • Corners lay before content, so you can and you will have content on the "cornering area". What you will have to do is to add a child element with position: relative and z-index more then 1: <div id="roundme"> <div style="position:relative; z-index:20;"> Hello world </div> </div>
  • You can set any radius and any transition to have different effects.
  • Transcorners are smart. They can guess any option if it is blank.
    • No border color set Transcorners check if there is border set in CSS. If it is set they will emulate it, if not then they will have the same color as the background-color of an element.
    • No background color set It will be the same background color as element has.
    • No corner color set It will be the same as element‘s parent background color.
    • Both border and background could be overriden in CSS

Compatability

They‘re just in development stage. Firefox and IE6 works perfectly, KHTML is yet untested after my possible fix. Opera is untested also. Any tests with screenshots and debugs would be appreciated. Leave them in the post comments please.

Browser Result
Firefox, Camino OK
Internet Explorer 6 OK
Konqueror OK
Opera 9 OK
Safari Fails (untested)
Internet Explorer 7 Fails (untested)
Opera 7 Untested
Opera 8 Untested

How to assemble?

East as pie!

//old style new Transcorner(ELEMENT, SIDE, OPTIONS); //new style ELEMENT.makeRounded(SIDE, OPTIONS);

What are these?

  1. ELEMENT: Usual variable with element.
    Like $(‘content‘) or $(‘myblock‘)
  2. SIDE: A string that declares the side which should be rounded:
    • ‘top‘ both top corners
    • ‘bottom‘ both bottom corners
    • ‘top left‘ just top left
    • ‘bottom right‘ just bottom right
    • ‘bottom right, top‘both top corners and bottom right
    • false all 4
    So we can set sides as a comma separated string. We can not have different corners on the same side: 10 pixel bottom left and 20px bottom right — that‘s impossible.
  3. OPTIONS: An object with values. Usual for moo scripts:
    • radius: 10 the amount of pixels should be rounded. This value is rough so play with it
    • borderColor: red the color of of 1px border around corners.
    • backgroundColor: #fff the color inside of the rounded part.
    • transition: fx.linear the transition function. Look into the mootools js file for more
    • onComplete: func the function that will be called on complete of rounding

Show me working examples!

//old style new Transcorner( $(‘content‘), //element ‘top right‘, //side { radius: 10, transition: fx.linear }//options );
//new style $(‘content‘).makeRounded(‘bottom left‘, {radius: 100});
//round all corners with 30
$(‘example1‘).makeRounded({radius: 30});
we also have background:transparent; and border:1px solid #fff; in CSS on this.
//round all corners with 10
$(‘example2‘).makeRounded();
//round top left corner with grey border and 20 pixel radius
$(‘example3‘).makeRounded(‘top left‘, {borderColor: ‘#777‘, radius: 20});
//round all top corners with 10
$(‘example4‘).makeRounded(‘top‘);
//round all top and bottom right cornerslinear transition
$(‘example5‘).makeRounded(‘top, bottom right‘, {transition: fx.linear});
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Rounding control corners
【Android】Android控件Shape
android shape实现阴影或模糊边效果
设置文本框:四个直角边变为圆角(border-top-left-radius)
一篇文章带你了解CSS3圆角知识
代码学习群简易教程(35)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服