Created
January 12, 2016 14:07
-
-
Save ecmelkytz/2d01b07a12f75c90d3eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= javascript_include_tag 'http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js' %> | |
<!-- Modal --> | |
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
<div class="modal-dialog modal-lg" role="document" > | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<h4 class="modal-title" id="myModalLabel">Duyuru</h4> | |
</div> | |
<div class="modal-body" > | |
<!-- Body content --> | |
</div> | |
<div class='modal-footer'> | |
<div class="checkbox pull-right"> | |
<label> | |
<input class='modal-check' name='modal-check' type="checkbox"> Okudum | |
</label> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Script --> | |
<script type="text/javascript" charset="utf-8"> | |
var my_cookie = $.cookie($('.modal-check').attr('name')); | |
if (my_cookie && my_cookie == "true") { | |
$(this).prop('checked', my_cookie); | |
console.log('checked checkbox'); | |
} | |
else{ | |
$('#myModal').appendTo("body").modal('show'); | |
console.log('uncheck checkbox'); | |
} | |
$(".modal-check").change(function() { | |
$.cookie($(this).attr("name"), $(this).prop('checked'), { | |
path: '/', | |
expires: 1 | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment