私はまだ問題を抱えており、それを修正する方法がわかりません。与えられた答えのおかげで、私はそれがどのように見えるかについての考えを持っていますが、それを機能させる方法がわかりません。
javascriptチェックボックスコードに問題があります。
divを非表示にする関数があります(他の投稿:javascript、右divが非表示の場合、左divは100%幅である必要があります)
しかし、ページを更新すると、チェックボックスが再びオンになり、Cookieについて何かを読みましたが、これを実装する方法がわかりません。
私のJavaScriptコード:
$(function() {
$("#foo").on("click",function() {
if ($(this).is(':checked')) $('#checked-a').show('fast',function() {
$('#checked-b').css("width","60%");
$('#checked-a').css("width","38%");
}) ;
else $('#checked-a').show('fast',function(){
$('#checked-b').css("width","100%").show();
$('#checked-a').css("width","0%").hide();
});
});
});
チェックボックスのHTMLコード:
<input type="checkbox" checked="checked" name="foo" id="foo" />
私のDivの:
<div class="content1" id="checked-b">
<%= button_to "Zoek", search_index_path, :method => :get, :class => 'contentlinks' %>
<%= button_to "Print", root_url, :class => 'contentlinks' %>
<%= button_to "Edit", root_url, :class => 'contentlinks' %>
<%= button_to "Add", root_url, :class => 'contentlinks' %>
<br>
<div class="spacing">
<%= yield %>
</div>
</div>
<div class="content2" id="checked-a">
ありがとう。