답변
jquery cookie plugin 쿠키 관리를 단순화 할 수 숨 깁니다. HTML 표시/숨기기에 관해서는 show()
및 hide()
메소드를 살펴보십시오. 정말 내용이/숨기기를 보여줄 필요가있는 경우/이유에 따라
...
은 만약 그렇다면, 당신은 어떻게 사용자 (세션을 식별하는, 특정 사용자에 대한 나타나야는 사용자가 특정 콘텐츠가 , openID)? 이벤트 구동 형입니까? 예를 들어 사용자가 버튼을 클릭하면 콘텐츠가 표시되거나 숨겨지고 쿠키가 표시/숨기기 상태를 저장합니까?
- 다모
사용자가 버튼을 클릭하면 콘텐츠가 표시되거나 숨겨지고 쿠키가 표시/숨기기 상태를 저장합니까? 클래스가있는 테이블을 숨길 필요가 있습니다 : .panel 또는 클래스가있는 div : #panel images : http://sis.windhover.com/buy/images/btn_show.gif 및 http://companies.elsevierbi.com/ Content/images/btn_hide.gif – user616324
당신이 필요로하는 것보다 아마도 더 많은,하지만 난 당신이 얻을 수있는) (.toggle 쿠키와 함께 상태를 저장, 테이블의 섹션을 확장/축소하려면 tablesorter에 플러그인으로 이것을 사용 좋은 효과.
function tableContainer(id,visible,sortColumn,sortOrder){
this.ID = id;
this.Visible = visible;
this.SortColumn = sortColumn;
this.SortOrder = sortOrder;
}
function bindTableHeaders(element){
//Bind click handler to the table THs to update object as to current sort column.
$("thead th","#" + element).bind("click",function(){
var order = this.order
var column = this.column
var $table = $(this).closest("table")
var visible = $table.attr("expanded") //Technically I suppose if you can click these then it must be visible
var id = $table.attr("id")
var tableObj = new tableContainer(id,visible,column,order);
$.cookie(element, JSON.stringify(tableObj), { secure: true }); //Write the current state into the section cookie
});
};
function recoverState(element) {
// pull cookie for page state and visibility
var elementData = $.cookie(element);
if (elementData != null){
// parse JSON based on object representation
var json = JSON.parse(elementData)
var id = json.ID;
var visible = json.Visible;
var sortColumn = json.SortColumn == undefined ? 0 : json.SortColumn
var sortOrder = json.SortOrder == undefined ? 0 : json.SortOrder
} else {
var id = element;
var visible = "true"
var sortColumn = 0;
var sortOrder = 0;
}
// switch visibility
if(visible == "false"){
toggleElement(element)
}
// Determine if this section has any data (eg. a <tbody>)
if ($("tbody","#" + id).length == 0 || $("tbody","#" + id).html() == "")
return
if (pageAction == "Edit"){
$("#" + id).tablesorter({widgets: ['zebra'], sortList: [[sortColumn,sortOrder]]});
} else {
$("#" + id)
.collapsible("td.collapsible",{
collapse:true
})
.tablesorter({widgets: ['zebra'], sortMultiSortKey:'false', sortList: [[sortColumn,sortOrder]]});
}
}
function toggleElement(element) {
if ($("#" + element).attr("expanded") == "true"){
$("#" + element).attr("expanded","false")
$("#" + element).hide();
var isVisible = "false"
} else {
$("#" + element).attr("expanded","true")
$("#" + element).show();
var isVisible = "true"
}
//Rewrite the cookie for this section changing only the visibility
var elementData = $.cookie(element);
var visible = isVisible;
if (elementData != null){
var json = JSON.parse(elementData)
var id = json.ID;
var sortColumn = json.SortColumn;
var sortOrder = json.SortOrder;
} else {
var id = element
var sortColumn = 0;
var sortOrder = 0;
}
var tableObj = new tableContainer(id,visible,sortColumn,sortOrder);
$.cookie(element, JSON.stringify(tableObj), { secure: true }); //Write the current state into the section cookie
}
- 1. Drupal 쿠키 만료 간단한 코드? 하나와
- 2. 스누피와 쿠키
- 3. 세션 쿠키 = 쿠키?
- 4. 쿠키
- 5. 쿠키
- 6. 쿠키
- 7. 쿠키
- 8. 간단한 질문 : 선언하고 다음 코드로 잘못 어떤 변수
- 9. 왜이 간단한 코드로 인해 스택 오버플로 예외가 발생합니까?
- 10. 간단한 C 코드로 모니터를 과열 할 수 있습니까?
- 11. 왜이 간단한 자바 바이트 코드로 인해 StackOverflow 오류가 발생합니까?
- 12. C# 3.0에서 간단한 방법으로 쿠키 내용을 암호화하는 방법은 무엇입니까?
- 13. 간단한 파이썬 CGI 쿠키 스크립트, 양식에서 데이터 가져 오기
- 14. 자바 스크립트에서 쿠키 값을 가져 오는 가장 간단한 방법
- 15. asp 쿠키 대 javascript 쿠키
- 16. jQuery 쿠키 플러그인으로 쿠키 설정하기?
- 17. urllib와 쿠키
- 18. 헤더로 쿠키 가져 오기
- 19. 로컬 호스트 쿠키
- 20. 쿠키 IE에서 삭제되지되는 8
- 21. Kohana의 요청 쿠키(), 응답 쿠키() 및 쿠키 클래스의 차이점은 무엇입니까?
- 22. 레일 3 개 쿠키
- 23. 코드로 XSD보기
- 24. Java에서 쿠키 관리
- 25. 오차 코드로 모듈 생성
- 26. jquery 쿠키 플러그인 또는 PHP 쿠키?
- 27. 자바 스크립트 쿠키 대 PHP 쿠키
- 28. 레일이 달린 Jquery 쿠키 (쿠키 유지)
- 29. 세션 및 쿠키
- 30. 블랙 베리에서 쿠키 읽기
이 쿠키 플러그인 만 사용합니다. –