position

Incorrect position of CAShapeLayer

浪尽此生 提交于 2019-12-04 21:04:21
I have a UIView called viewProgress . It is the white box in the image. I want a circular progress bar, which is the green circle in the image. The progress bar should stay within the white box, but as you can see it is way off. How do I make it stay inside the viewProgress ? Here you have my animation function: func animateView() { let circle = viewProgress // viewProgress is a UIView var progressCircle = CAShapeLayer() let circlePath = UIBezierPath(arcCenter: circle.center, radius: circle.bounds.midX, startAngle: -CGFloat(M_PI_2), endAngle: CGFloat(3.0 * M_PI_2), clockwise: true)

Top navbar (under header) fixed on top of screen when scrolling

这一生的挚爱 提交于 2019-12-04 20:44:11
When scrollbar is on top browser displays: HTML: ------------------------- | HEADER | ------------------------- | NAVBAR | ------------------------- | body | ------------------------- When scrollbar is down NOW browser normally displays: HTML: ------------------------- | | | body | | | ------------------------- But I'd like to have: ------------------------- | NAVBAR | ------------------------- | | | body | | | ------------------------- I tried with: <div id="navbar">...</div> CSS: #navbar { position:fixed; z-index:1; } But this only works if navbar is on the top position. I have the header on

JS各种案例效果

蓝咒 提交于 2019-12-04 19:57:32
1.进度条拖拽 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>进度条拖拽</title> <style> *{margin: 0;padding: 0;} .box{display: flex;width: 500px;height: 300px;background: #dedede;align-items: center;margin-left: 20px;} .box span{width: 100px;text-align: center;} .con{width: 400px;height: 30px;background: gray;display: flex;align-items: center;} .con p {height: 30px;width: 10px;background: blue;position: relative;} .con i {height: 40px;width: 10px;background:

CSS 水平对齐(Horizontal Align)

荒凉一梦 提交于 2019-12-04 19:37:28
CSS 水平对齐(Horizontal Align) 在CSS中,有几个属性用于元素水平对齐。 块元素对齐 块元素是一个元素,占用了全宽,前后都是换行符。 块元素的例子: <h1> <p> <div> 文本对齐,请参阅 CSS文本 章节。. 在这一章中,我们会告诉你块元素如何水平对齐布局。 中心对齐,使用margin属性 块元素可以把左,右页边距设置为"自动"对齐。 Note: 在IE8中使用margin:auto属性无法正常工作,除非声明 !DOCTYPE margin属性可任意拆分为左,右页边距设置自动指定,结果都是出现居中元素: .center { margin-left:auto; margin-right:auto; width:70%; background-color:#b0e0e6; } 提示: 如果宽度是100%,对齐是没有效果的。 注意: IE5中块元素有一个margin处理BUG。为了使上述例子能工作,在IE5中,需要添加一些额外的代码。 实例 使用position属性设置左,右对齐 元素对齐的方法之一是使用绝对定位: .right { position:absolute; right:0px; width:300px; background-color:#b0e0e6; } 注意: 绝对定位与文档流无关,所以它们可以覆盖页面上的其它元素。

Position calculation of small model of a car using Accelerometer + Gyroscope

…衆ロ難τιáo~ 提交于 2019-12-04 19:33:31
I wish to calculate position of a small remote controlled car (relative to starting position). The car moves on a flat surface for example: a room floor. Now, I am using an accelerometer and a gyroscope. To be precise this board --> http://www.sparkfun.com/products/9623 As a first step I just took the accelerometer data in x and y axes (since car moves on a surface) and double integrated the data to get position. The formulae I used were: vel_new = vel_old + ( acc_old + ( (acc_new - acc_old ) / 2.0 ) ) * SAMPLING_TIME; pos_new = pos_old + ( vel_old + ( (vel_new - vel_old ) / 2.0 ) ) * SAMPLING

css图像拼合技术(精灵图)

放肆的年华 提交于 2019-12-04 19:04:40
CSS图像拼合技术 1.图像拼合 图像拼合技术就是单个图像的集合。 有很多图片的网页可能会需要很多时间来加载和生成多个服务器的请求。 使用图像拼合会降低服务器的请求数量,并节省带宽。 图像拼合实例 有了css样式,我们可以显示我们需要的图像的一部分 详细代码如下: <!doctype html> <html> <head> <meta charset="utf-8"/> <title>图片整合</title> <style> .box{ width:200px; margin:0 auto; overflow:hidden; } .iton{ width:43px; margin-left:10px; height:44px; float:left; background:url(images/img_navsprites_hover.gif) no-repeat; } .span01{ background-position:0 0; } .span02{ background-position:-47px 0; } .span03{ background-position:-91px 0; } .span01:hover{ background-position:0 -45px ; } .span02:hover{ background-position:-47px -45px

Footer at the bottom in fluid layout

限于喜欢 提交于 2019-12-04 19:00:14
问题 I have a fluid layout but as a consequence, when there is no enough content in the page, my footer keeps moving up as in this example. A popular solution to keep the footer at the bottom of the page is using position: fixed or position: absolute , however, when I do that, the content can collide with the footer on resizing (you can see what I mean here. Try to resize your window to the point in which the text is hiding behind the footer). So how can I get a footer at the bottom but moving

Textview on(above) Button, doesn't work in Android 5(API 21)

荒凉一梦 提交于 2019-12-04 18:36:21
问题 It looks like a bug in 5 Android(API 21). I need a textview on button, textview should placed above the button. It works correct on Android 4.1(API 16) and incorrect on 5 Android(API 21). There are Screenshots and code: Android 4.1 - It is correct, red textview above the button Android 5 - it is incorrect , red textview under the button! Code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rlBottom" android

【前端知识体系】CSS布局知识强化

给你一囗甜甜゛ 提交于 2019-12-04 18:28:13
1.实现两栏/三栏布局的方法? 表格布局 float + margin布局 inline-block布局 flexbox布局(兼容性的问题) 1.1 基础布局 <style> * { margin: 0; padding: 0; } .layout { margin-top: 10px; } .layout div{ min-height: 100px; } </style> <body> <!--1.浮动的方式来实现布局--> <section class="layout float"> <style> .layout.float .left { float: left; width: 300px; background-color: #48adff; } .layout.float .main { background-color: #ff4344; } </style> <article class="left-main"> <div class="left"></div> <div class="main"> <h1>浮动两栏布局</h1> <p>两栏布局的中间部分</p> <p>两栏布局的中间部分</p> </div> </article> </section> <!--2.定位的方式来实现布局--> <section class="layout absolute">

Footer won't stay in the bottom of the page

荒凉一梦 提交于 2019-12-04 16:47:28
I'm am having some trouble, trying to get my footer to stay at the bottom of my page and the only tutorials I can find has a fixed position, which I dont want it to. I just want the footer to stay at the bottom of the page, so if the copyright line is at 1000px down on the page, that is where the footer will be. Right now it is at the top of the page, right under the header which it isn't supposed to. My code (html): <body> <div id="footer"> <div class="CopyrightLine"> © Copyright </div> </div> </body> My code (css): #footer{ width: 100%; height: 200px; background-color: #000000; float: left;