2013-09-03 1 views
1

https://github.com/carhartl/에 의해 플러그인에서 설정 한 만료 매개 변수에 대해 초 단위로 형식화 된 js 비트를 얻으려면 어떻게해야할까요? 여기jquery.cookie.js 플러그인에서 일 단위에서 초 단위로 변경

(또한, ominflowWindow와 함께 사용) 내가 잘 작동하고, 무엇을 가지고 :

function OverlayClose() { 
     jQuery(".ow-overlay, .modal").hide("slow"); 
    } 
jQuery(document).ready(function() { 
    if (jQuery.cookie('product_2min_modal') == null) { 
     jQuery.cookie('product_2min_modal', 'yes', { 
      expires: 1, 
      path: '/' 
     }); 
     setTimeout(function() { 
      jQuery('div.modal').omniWindow() // create modal 
      .trigger('show'); 
     }, 5000 // and show it 
     ); 
    } 
}); 

나는 기능에 바로 이런 걸 코드 수 있을까요?

function OverlayClose() { 
      jQuery(".ow-overlay, .modal").hide("slow"); 
     } 
    jQuery(document).ready(function() { 
     if (jQuery.cookie('product_2min_modal') == null) { 
      jQuery.cookie('product_2min_modal', 'yes', { 
       expires: 
var date = new Date(); 
var minutes = 2; 
date.setTime(date.getTime() + (minutes * 60 * 1000)); 
$.cookie("product_2min_modal", { expires: date }); 
, 
       path: '/' 
      }); 
      setTimeout(function() { 
       jQuery('div.modal').omniWindow() // create modal 
       .trigger('show'); 
      }, 5000 // and show it 
      ); 
     } 
    }); 

답변

2

당신은 구문 오류

function OverlayClose() { 
    jQuery(".ow-overlay, .modal").hide("slow"); 
} 
jQuery(document).ready(function() { 
    if (jQuery.cookie('product_2min_modal') == null) { 
     var date = new Date(); 
     var minutes = 2; 
     date.setTime(date.getTime() + (minutes * 60 * 1000)); 
     jQuery.cookie('product_2min_modal', 'yes', { 
      expires: date, 
      path: '/' 
     }); 
    } 
}); 
+0

굉장이있다! 그건 없어 졌어! Arun을 똑바로 설정해 주셔서 감사합니다. 훌륭한. –

관련 문제