pStack DOM element stack
pStack plugin for jQuery.
Allows successive AJAX calls to replace contents of an element, whilst keeping previous contents in a stack.
Previous element contents can then be recalled by pop()ing them back off the stack.
Usage:
<script src="jquery.pagestack.js" type="text/javascript"></script>
<div id="myStack">
<p>this is the DOM chunk which dynamic things will happen to</p>
<p><a href="nextView.html" class="stackPush">Next ---</a></p>
</div>
<script type="text/javascript">
$('#myStack').pStack({
aPush: 'a.stackPush',
aPop: 'a.stackPop'
});
</script>
nextView.html might look like this (ie, not a complete HTML document):
<p>This is my new DOM contents</p>
<p><a href="#" class="stackPop">--- Prev</a></p>
评论