jquery プラグインの動作に問題がありました。jquery ウィンドウが表示され、ユーザーが条件に同意するか同意しないかを尋ねます。ユーザーが [はい] を押すことに同意すると、Cookie が保存され、Cookie の有効期限が切れるまでウィンドウは戻りません。いいえを押すと、別の URL にリダイレクトされます。
スクリプトは以下です。
ユーザーがはい/緑色のボタンをクリックしたときに、jquery.cookies.js を統合して Cookie を書き込むにはどうすればよいですか? コールバックなどをグーグル検索しましたが、役に立ちませんでした。
公開プラグインをこのように動作させるにはどうすればよいですか?
助けてください!
(PS別のユーザーからの質問は似ていますが、同じではありません。なぜなら、[閉じる] をクリックし、[はい] [いいえ] ボタンではなく、同じことを行うためです。 この jQuery Cookie の何が間違っていますか? )
以下は私がこれまでに持っているものです
<!--jQuery-->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> -->
<script src="js/jquery.min.js"></script>
<script src="js/jquery.reveal.js"></script>
<script src="js/jquery.cookie.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (!(jQuery.cookie("agree"))) {
$('#modal').reveal({ // The item which will be opened with reveal
animation: 'fade', // fade, fadeAndPop, none
animationspeed: 500, // how fast animtions are
closeonbackgroundclick: false, // if you click background will modal close?
dismissmodalclass: 'close' // the class of a button or element that will close an open modal
});
}
});
$(".close").live("click",function () {
$.cookie("agree", 1, { expires: 1, path: '/' });
});
</script>
</head>
<body>
<div id="modal">
<img src="images/images.jpg" alt="image test" width="360" height="194" hspace="0" vspace="0" border="0" align="top">
<div id="heading">heading/div>
<div id="content">
<p>Do you agree yes or no?</p>
<a href="#" class="button green close"><img src="images/tick.png">Yes</a>
<a href="http://google.com" class="button red close"><img src="images/cross.png">No</a>
</div>
</div>