JQuery 사이트 스킨 케 어 기능 구현 코드
                                            
 4197 단어  JQuery사이트 스킨 케 어
                    
 
$(document).ready(function() { 
$('.styleswitch').click(function() 
{ 
switchStylestyle(this.getAttribute("rel")); 
return false; 
}); 
var c = readCookie('style'); 
if (c) switchStylestyle(c); 
}); 
function switchStylestyle(styleName) 
{ 
$('link[@rel*=style][title]').each(function(i) 
{ 
this.disabled = true; 
if (this.getAttribute('title') == styleName) this.disabled = false; 
}); 
createCookie('style', styleName, 365); 
} 
 
/** 
* Styleswitch stylesheet switcher built on jQuery 
* Under an Attribution, Share Alike License 
* By Kelvin Luck ( http://www.kelvinluck.com/ ) 
**/ 
(function($) 
{ 
$(document).ready(function() { 
$('.styleswitch').click(function() 
{ 
switchStylestyle(this.getAttribute("rel")); 
return false; 
}); 
var c = readCookie('style'); 
if (c) switchStylestyle(c); 
}); 
function switchStylestyle(styleName) 
{ 
$('link[@rel*=style][title]').each(function(i) 
{ 
this.disabled = true; 
if (this.getAttribute('title') == styleName) this.disabled = false; 
}); 
createCookie('style', styleName, 365); 
} 
})(jQuery); 
// cookie functions http://www.quirksmode.org/js/cookies.html 
function createCookie(name,value,days) 
{ 
if (days) 
{ 
var date = new Date(); 
date.setTime(date.getTime()+(days*24*60*60*1000)); 
var expires = "; expires="+date.toGMTString(); 
} 
else var expires = ""; 
document.cookie = name+"="+value+expires+"; path=/"; 
} 
function readCookie(name) 
{ 
var nameEQ = name + "="; 
var ca = document.cookie.split(';'); 
for(var i=0;i < ca.length;i++) 
{ 
var c = ca[i]; 
while (c.charAt(0)==' ') c = c.substring(1,c.length); 
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 
} 
return null; 
} 
function eraseCookie(name) 
{ 
createCookie(name,"",-1); 
} 
// /cookie functions 
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
JQuery 사이트 스킨 케 어 기능 구현 코드여기 서 언급 되 지 않 은 부분 은 뒤에서 볼 수 있 는 쿠키 를 만 들 고 읽 는 함수 입 니 다.익숙 한 시작$(document).ready(function(){$('styleswitch').click(func...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.