글
ajax 뒤로가기 구현
J/Jquery
2012. 3. 8. 02:21
http://benalman.com/projects/jquery-hashchange-plugin/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>#hash test</title>
<script type="text/javascript" src="/skin/default/script/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="/skin/default/script/jquery.ba-hashchange.1.3.min.js"></script>
<script type="text/javascript">
$(function() {
$(window).hashchange(function() {
switch(location.hash) {
case '':
case '#':
$('#contents').text('nothing');
break;
case '#a':
case '#b':
case '#c':
$('#contents').text('this is ' + location.hash);
break;
}
}).hashchange();
});
</script>
</head>
<body>
<a href="#a">a</a>
<a href="#b">b</a>
<a href="#c">c</a>
<div id="contents"></div>
</body>
</html>
'J > Jquery' 카테고리의 다른 글
jQuery JSONP ajax 호출, JSON 관하여 (0) | 2014.03.19 |
---|---|
[jQuery] $(document).ready(function(){}); (0) | 2012.03.10 |
jquery 사용시 prototype.js 충돌시 해결 방법 (0) | 2012.03.03 |
ajax와 뒤로가기 (0) | 2012.02.06 |
Ajax와 뒤로가기 버튼 (0) | 2012.02.05 |