سؤال

<!-- Modal -->
<div id="appsmodal" class="modal hide fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
<script type="text/javascript">
    $(document).ready(function() {

        if($.cookie('msg') == 0)
        {
            $('#appsmodal').modal('show');
            $.cookie('msg', 1);
        }

    });
</script>

I have been mind boggled for about an hour now to no avail. I prefer not to ask questions until I have used all my resources.

هل كانت مفيدة؟

المحلول

From the docs https://github.com/carhartl/jquery-cookie:

Create session cookie:

$.cookie('the_cookie', 'the_value');
Create expiring cookie, 7 days from then:

$.cookie('the_cookie', 'the_value', { expires: 7 });
Create expiring cookie, valid across entire site:

$.cookie('the_cookie', 'the_value', { expires: 7, path: '/' });
Read cookie:

$.cookie('the_cookie'); // => "the_value"
$.cookie('not_existing'); // => undefined
Read all available cookies:

$.cookie(); // => { "the_cookie": "the_value", "...remaining": "cookies" }
Delete cookie:

Have your browser's console open and check for any error statements (are you including the cookie library, for example). Also, use the inspector in your browser to make sure the cookie is actually being set: http://getfirebug.com/cookies

نصائح أخرى

FINALLY!

I figured it out. Joomla issue

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top