2013-04-01 6 views
0
<!-- 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> 

저는 약 한시간 동안 아무런 소용이 없다고 생각합니다. 나는 모든 자원을 다 사용하기 전에는 질문하지 않는 것을 선호합니다. 워드 프로세서 https://github.com/carhartl/jquery-cookie에서Jquery 쿠키 코드가 작동하지 않습니다.

+0

이것은 길이가 무엇입니까? if (! $. cookie ('msg'). 길이) 또는 유사합니까? 만약 멍청한 'msg'가 설정되지 않았다면, 0이되지 않을 것입니다. 단지 존재하지 않을 것입니다. – orolo

+0

.length? 응? jquery cookie.js 및 부트 스트랩 모달 – Binary101010

+0

$ .cookie ('msg')를 설정하지 않은 경우 if ($. cookie ('msg') == 0)가 절대로 true를 반환하지 않을지 궁금합니다. == 0. 그것은 존재하지 않을 것입니다. 그러나 $ .cookie ('msg'). 길이 == 0이면 찾고있는 것을 반환 할 수 있습니다. – orolo

답변

1

:

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: 

오픈 브라우저의 콘솔을하고 (당신은 예를 들어, 쿠키 라이브러리를 포함하는) 오류 문을 확인합니다. 또한 브라우저의 관리자를 사용하여 쿠키가 실제로 설정되었는지 확인하십시오. http://getfirebug.com/cookies

+0

orolo 감사합니다. 대단히 감사합니다 – Binary101010

1

마침내!

나는 그것을 알아 냈다. Joomla 문제

+0

멋지다! 업데이트 주셔서 감사합니다. – orolo

관련 문제