JS、HTML、CSSを初めて使用しています。これまではランダムなカードを作成するボタンを作成しました。カードにはp
というタグ "title"があります。カードをクリックすると、2つの入力フィールドと保存ボタンと削除ボタンが表示されます。ランダムなカードを押してpタグを入力フィールドに入れます。
私はデザインに助けが必要です。私はベストを尽くしましたが、私はこの2つのボタンと2つの入力フィールドをよく見えるようにすることはできません。あなたは私を助けてくれますか?
カードをクリックすると、
p
タグのタイトルが入力フィールドの1つに入ります。input
フィールドをクリックすると、p
タグが再び消えるはずです。私が最後に作りたいのは、編集モードにできるのは1枚だけです。
これは私のコードです:
$(document).ready(function() {
$("button.plus").on("click", function() {
var newCard = $('#cardPrototype').clone(true);
$(newCard).css('display', 'block').removeAttr('id');
$('#newCardHolder').append(newCard);
});
$('body').on('click', '.card', function() {
$(this).find('form').show();
$(this).find('span').remove();
});
/*delete button*/
$('body').on('click', '.card .delete', function() {
$(this).closest('.card').remove();
});
});
.item {
width: 300px;
margin-right: 5px;
margin-left: 5px;
margin-bottom: 10px;
float: left;
padding: 10px;
background-color: #BBBBBB;
border: 1px solid #ccc;
border-radius: 10px;
}
button div.item {
right: 0;
margin-right: 10px;
height: 80px;
width: 80px;
border-top-left-radius: 55px;
border: 5px solid white;
background-color: #666666;
font-size: 70px;
color: white;
text-align: center;
line-height: 75px;
bottom: 10px;
position: fixed;
cursor: pointer;
z-index: 2;
}
.input-feld {
font-family: TheSans Swisscom;
margin: 3px;
width: 260px;
}
.card {
width: 300px;
margin-right: 5px;
margin-left: 5px;
margin-bottom: 10px;
float: left;
padding: 10px;
background-color: #BBBBBB;
border: 1px solid #ccc;
border-radius: 10px;
position: relative;
}
.delete {
font-family: 'TheSans Swisscom';
right: 12px;
top: 0;
position: absolute;
}
.speichern {
font-family: 'TheSans Swisscom';
background-color: greenyellow;
border-radius: 5px;
}
.abbrechen {
font-family: "TheSans Swisscom";
background-color: red;
border-radius: 5px;
margin-left: 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="plus">
<div class="item">
<p>+</p>
</div>
</button>
<div id="newCardHolder">
</div>
<div id="cardPrototype" class="card" style="display:none;">
<p class="delete">x</p>
<span>Title</span>
<form name="theform" style="display:none;">
<input class="input-feld" type="text">
<br>
<input class="input-feld " type="text">
<br>
<input class="speichern"type="button" onClick="new Person()" value="Speichern">
<input class="abbrechen"type="button" onClick="new Person()" value="Abbrechen">
</form>
</div>
レトに表示されます
span
タグ最初の質問はデザインに関連しており、主観的であるため、本当に助けることはできません。 –
「私は何かをしたい、これは私が持っているものであり、私のためにそれをコードしてください」。これはあなたがSOFで質問するべき方法ではありません。自分自身でコードに問題を提示する必要があります。あなたのコードの問題は何ですか? – Trix