目标:
你需要画这条线。为了更好地理解 - 蓝色部分是金额的 100% 的 5%(我也从 100% 的行中理解):
我做了什么:
正如你所看到的,我只有一条线,是的,我可以用颜色填充它,但我不知道如何在屏幕截图中绘制上面的内容
问题:
- 是否有任何现成的解决方案(在 UIBezierPath 中)来计算填充百分比?
- 是否有为此准备好的库?
- 应该使用什么方法/算法来动态计算条形的填充?
目标: 当用户单击按钮时,从 Firebase 获取结果并将其呈现在 CollectionView 中。
现在做什么:
当我第一次进入应用程序时,我向 Firebase 发出请求并得到响应,一切都按原样绘制,单元格就位,集合也是。我的单元格是定制的,并在.xib
一个文件中制作。现在我已经实现了获取其他信息的逻辑,我只更改了一个词,以便从 firebase 接收到的数据已经不同。在调试器中,我检查了单击后 DataSource 中的数组是否包含新数据,逻辑工作正常,但之后collectionView.reloadData()
没有任何反应。没有错误。只有没有检查nil,然后是的,应用落在collectionView上
根据调试器:collectionView - nil
, numberOfItemsInSection
- 没有被调用并且单元格没有更新(因此,UI也没有更新)..
我尝试了什么:我有
在后台线程中接收数据的代码,reloadData
我在主线程中完成了它,我删除了线程,因为我认为线程存在问题 - 它没有帮助。我试图找到解决方案,大多数答案类似于:“您正在尝试在后台线程中更新数据”或“您有一个非 IB 集合”等等,不适用于我的问题。
代码: 我会尝试发布您需要的内容。
// метод который срабатывает при получение интерактива от пользователя, как я сказал
// до строчки с reload все работает, а после ничего не происходит
DispatchQueue.global(qos: .userInitiated).async {
self.db.collection(K.FStore.collectionName!)
.order(by: "date", descending: true)
.addSnapshotListener { (querySnapshot, error) in
if let e = error {
print("Ошибка при получение карточек \(e)")
} else {
self.cards = []
if let snap = querySnapshot?.documents {
for item in snap {
let data = item.data()
if let fio = data[K.FStore.fullName] as? String, let price = data[K.FStore.price] as? String, let phone = data[K.FStore.phone] as? String, let description = data[K.FStore.description] as? String, let address = data[K.FStore.address] as? String {
let newCard = Card(fio: fio, phone: phone, price: price, description: description, address: address, idCard: item.documentID)
self.cards.append(newCard)
}
}
DispatchQueue.main.async {
self.collectionView?.reloadData()
}
}
}
}
}
// self.cards - это массив Card, где есть определенная информация по карточке, потом Card я сделал в Cell ( т.е. кастомная ячейка - это карточка
// UICollectionViewDataSource
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return cards.count
}
//cellForItemAt
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cardCell: Card
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.cellMainScreenIndet, for: indexPath) as! MainCellCollectionView
cardCell = cards[indexPath.row]
cell.fioLabel.text = cardCell.fio
cell.priceLabel.text = cardCell.price
cell.addressLabel.text = cardCell.address
cell.discriptionLabel.text = cardCell.description
cell.phoneLabel.text = cardCell.phone
return cell
}
希望对您有所帮助,因为初学者仍然是完整的,我不明白我在哪里犯了错误以及为什么该语言会这样工作!
如何对齐容器 ( fluid
) 的背景以使其完全显示。
有一张图片 (SVG) - 一个波浪,如果您通过 指定bg-url
,那么图片的顶部、中心或底部都是可见的。
第一个屏幕。我得到什么,2 个屏幕,你需要什么。但是由于图片是svg的,无法上传到网上获取链接,所以还有一张图片,但问题依旧存在。即图片与顶部和底部的对齐方式。
我的代码:
.ribbon_first {
background: url(https://cdn.pixabay.com/photo/2017/05/16/11/45/blue-waves-2317606_960_720.png) no-repeat;
background-size: 100%;
background-position: 100%;
height: 100%;
}
<section class="container-fluid ribbon_first">
<div class="container">
<div class="row">
<div class="col-md-6 whomСourse-about">
<h2>Курс идеально подойдет</h2>
<p>Тем, кто хочет продвигать бренды в Инстаграм, используя все его преимущества</p>
</div>
</div>
</div>
</section>
我以各种可能的方式尝试减小容器的大小,但单元格根本没有减小。那些。边框应与照片相同。我将非常感谢踢球,谢谢!
<table cellpadding="0" cellspacing="0" width="100%" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;border-left:1px solid #292929;border-right:1px solid #292929;border-top:1px solid #292929;border-bottom:1px solid #292929;background-position:center top;">
<tr style="border-collapse:collapse;">
<td align="center" class="es-m-txt-c" style="padding:0;Margin:0;padding-top:30px;">
<p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:15px;font-family:'open sans', 'helvetica neue', helvetica, arial, sans-serif;line-height:23px;color:#333333;">Введите этот код в корзине</p>
<p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:15px;font-family:'open sans', 'helvetica neue', helvetica, arial, sans-serif;line-height:23px;color:#333333;">перед оформлением</p>
<p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:15px;font-family:'open sans', 'helvetica neue', helvetica, arial, sans-serif;line-height:23px;color:#333333;">заказаfourseasonsshop.ru</p>
</td>
</tr>
<tr style="border-collapse:collapse;">
<td align="center" style="Margin:0;padding-bottom:15px;padding-left:15px;padding-right:15px;padding-top:25px;">
<p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:15px;font-family:'open sans', 'helvetica neue', helvetica, arial, sans-serif;line-height:23px;color:#333333;">Код для скидки 15%:</p>
<h4 id="code" style="Margin:0;line-height:22px;mso-line-height-rule:exactly;font-family:'open sans', 'helvetica neue', helvetica, arial, sans-serif;font-size:18px;">GG-FF-DD</h4>
</td>
</tr>
<tr style="border-collapse:collapse;">
<td align="center" bgcolor="transparent" style="Margin:0;padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:40px;"> <span class="es-button-border" style="border-style:solid;border-color:transparent;background:#292929;border-width:0px;display:inline-block;border-radius:0px;width:auto;"> <a href="" class="es-button" target="_blank" style="mso-style-priority:100 !important;text-decoration:none;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:'open sans', 'helvetica neue', helvetica, arial, sans-serif;font-size:12px;color:#FFFFFF;border-style:solid;border-color:#292929;border-width:15px 40px;display:inline-block;background:#292929;border-radius:0px;font-weight:normal;font-style:normal;line-height:14px;width:auto;text-align:center;">Перейти на сайт</a> </span> </td>
</tr>
</table>
单击列名时如何对列进行排序?我知道已经提出了这个问题,但是有一个完全不同的代码我无法弄清楚。来自数据库的表数据。我将非常感谢您的帮助!我不知道如何在这里插入 PhP 代码,所以我将它添加到 HTML 中。
<?php
$db_host = "127.0.0.1";
$db_name = "test_codez";
$db_user = "root";
$db_pass = "";
$db = mysqli_connect ($db_host, $db_user, $db_pass, $db_name) or die ("Невозможно подключиться к БД");
?>https://ru.stackoverflow.com/questions/ask#
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<table>
<?php
$sql = "SELECT * FROM test_table2";
echo "<table>";
echo "<table><tr><th>Alphabetic</th><th>Numeric</th><th>Date</th><th>Unsortable</th></tr>";
$sql = mysqli_query($db, "SELECT * FROM test_table2");
while ($result = mysqli_fetch_array($sql))
{
echo "<tr><td>".$result['Alphabetic']."</td><td>".$result['Numeriс']."</td><td>".$result['Date']."</td><td>".$result['Unsortable']."</td></tr>";
}
echo "</table>";
?>
</table>
</body>
</html>
大家好!起初背景有问题,但经过多次尝试,我能够修复背景,使其在使用 localStorage 更新或转换后不会改变,现在我不明白为什么在一段时间后(例如 3 秒)它确实没变。
请告知如何解决这个问题?我认为它在 localStorage 中未完成,但我不知道如何修复它。感谢大家!
window.onload = function() {
const date = new Date();
const time = date.getHours() + ':' +addZero(date.getMinutes());
document.getElementsByTagName('div') [1].innerHTML = time;
window.setTimeout(arguments.callee, 1000);
function addZero(num) {
var str = num.toString();
return str.length == 1? "0" + str : str;
};
} ();
function getRandomArbitrary(min, max) {
return Math.floor(min + Math.random() * (max + 1 - min))
}
let randomItem = getRandomArbitrary(0,36)
if(window.innerWidth = 1600) {
document.getElementsByClassName('p1')[randomItem].style.display="block";
}
localStorage.setItem('name', 'conteiner');
document.getElementById('conteiner').innerHTML = localStorage.getItem('name');
localStorage.removeItem('name');
const phr = new Array();
phr.push("https://images.wallpaperscraft.ru/image/les_tuman_derevia_126479_1920x1080.jpg");
phr.push("https://images.wallpaperscraft.ru/image/gory_ozero_vershiny_vid_sverkhu_119133_1920x1080.jpg");
function Rotator_cont() {
const s = 3000;
const N = phr.length;
const i = Math.round(Math.random() * (N));
Rotator(i);
function Rotator(i) {
i++;
if (i > N - 1) {
i = 0
}; //alert(i);
document.getElementById('conteiner').style.backgroundImage = 'url(' + phr[i] + ')';
timerId01 = setTimeout(function() {
Rotator(i)
}, s);
return;
}
}
Rotator_cont()
#conteiner {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.mainTime {
display: flex;
margin-top: 110px;
font-size: 200px;
color:white;
}
.mainWord {
display: flex;
font-size: 50px;
position: absolute;
margin-top: 190px;
color:white;
}
.p1 {
display: none;
}
<div id="conteiner">
<div class="mainTime"></div>
<div class="mainWord">
<div class="p1">Fortune favors the brave</div>
</div>
</div>
好的,人们用#指出了错误。但是现在,在“容器”窗口中,语言环境不起作用,控制台中的错误是相同的(Uncaught TypeError: Cannot set property 'innerHTML' of undefined),并且背景在计时器上发生变化。
让我解释一下我要做什么:这是我(用户)我在页面上,我看到了背景(它有一个 5 分钟的计时器)。关闭了页面。3分钟后。我再次登录并看到相同的背景。又关门了。但是10分钟后我会进来,背景已经改变了。那些。将计时器本身+用户拥有的背景保存在本地。
背景本身附加到一个空的div,我认为这是错误的问题。
一个有趣的时刻出现了,即当分辨率为 768 像素或更高的移动版网站没有白色缩进时。
但如果分辨率为425px及更低,分辨率越低,白色缩进越大。我寻求帮助以解决问题或指出我在@media 中写错的地方和内容
我将不胜感激!
@media screen and (min-width: 360px) {
html, body {
width: 100%;
}
.b1 {
width: 100%;
height: 100%;
background: url(First.jpg) repeat;
}
.b1 h1 {
font-size: 60px;
}
<section class="b1">
<div class="content1">
<h1>OMG I NEED HELP</h1>
<a class="btn" href="#Stop" onclick="slowScroll('#Stop')">See more</a>
<a class="btn" href="contactform.html">Contact with me</a>
</div>
</section>
当您单击图像时,它应该以更大的尺寸浮动。一切都很好,但这是将它移到中心的方法,右边缘的一部分是灰色的。
也许我是盲人,但我根本看不到问题所在。没有颜色变化,没有任何帮助,它只是被裁剪了,就是这样。
jQuery v3.3.1
代码,即脚本及其样式不是我的。我自己对此很陌生。所有与问题(代码)相关的内容都已附上。+ 屏幕
UPD:使用“poke”方法,出于某种原因,我决定在 property.popup_bg
中,即它width 100%
不是 100%。一输入150%,整个背景变暗,一切正常。同时,如果这个属性不存在,则无法关闭扩展图像。(很可能是脚本的原因)
如果你能告诉我原因,我会很高兴。:)
$(document).ready(function() {
$(".image").click(function() {
var img = $(this);
var src = img.attr('src');
$("body").append("<div class='popup'>" +
"<div class='popup_bg'></div>" +
"<img src='" + src + "' class='popup_img' />" +
"</div>");
$(".popup").fadeIn(800);
$(".popup_bg").click(function() {
$(".popup").fadeOut(800);
setTimeout(function() {
$(".popup").remove();
}, 800);
});
});
});
.image {
/* margin:30px; */
/* float:left; */
cursor: pointer;
max-height: 300px;
}
.popup_img {
position: fixed;
margin: 0 auto;
z-index: 2;
max-height: 94%;
max-width: 94%;
margin-top: 25px;
pointer-events: none;
}
.popup {
position: fixed;
height: 100%;
width: 100%;
top: 0;
right: 300px;
display: none;
text-align: center;
}
.popup_bg {
background: rgba(0, 0, 0, 0.699);
position: fixed;
z-index: 1;
height: 100%;
width: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section class="b3">
<div class="in3">
<div class="content3">
<h2>Your thoughts</h2>
<div class="audio1">
<div class="cover1">
<img src="http://via.placeholder.com/250x250/ff00ff/000000" class="image" width="280px" height="280px" style="margin-bottom: 5px">
<p class="nameCover1">Citizen — Yellow Love</p>
</div>
<audio src="6666.mp3" controls>Citizen — Yellow Love</audio>
</div>
</div>
</div>
</section>
大家好!我有一个愚蠢的问题,即为什么元素没有隐藏在给定的高度?
< script >
$(window).scroll(function() {
// если пользователь прокрутил страницу более чем на 850px
if ($(this).scrollTop() > 850) {
// то сделать кнопку scrollup видимой
$('.down').fadeIn();
}
// иначе скрыть кнопку scrollup
else if ($(this).scrollTop() <= 850) {
$('.down').fadeOut();
} else if ($(this).scrollTop() > 1000) {
$('.down').fadeOut();
}
}); <
/script>
.down {
position: fixed;
left: 20px;
display: none;
bottom: 50%;
opacity: .3;
animation: sizeDown 2s infinite alternate; /* анимация повторения*/
}
@keyframes sizeDown { /* Название анимации, которое идет после в animation */
from { /* От */
width: 60px;
height: 100px;
}
to { /* До */
width: 80px;
height: 120px;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="down">
<img src="lookDown.png" width="80px" height="100px">
</div>
我没有看到错误,很可能是 jquery。版本 3.3.1。我附上了与元素相关的所有内容。
2 如果需要隐藏元素,如果它高于给定的高度。但是这里 3 不起作用,它没有隐藏..