使用http://codebomber.com/jquery/slidepanel/
我沒有看到這樣的選項來從本地元素加載內容。我更改了插件源文件中的一些代碼。現在你可以從本地元素加載文本。
<a href="#" data-slidepanel="panel">Show Panel</a>
<div id="panel-content" style="display:none;">
This is the content of the panel.
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/jquery.slidepanel.js"></script>
<script>
$(document).ready(function(){
$('[data-slidepanel]').slidepanel({
orientation: 'right',
mode: 'overlay'
});
});
</script>
而在jquery.slidepanel.js文件刪除這些行(行號100-105):
$('.inner .wrapper', this.$panel).html('').load(href, function() {
// remove the loading indicator
base.$panel.removeClass('loading');
// set the current loaded URL to the target URL
base.$panel.data('slidepanel-loaded', href);
});
,而不是補充一點:
$('.inner .wrapper', this.$panel).html($('#panel-content').html());
base.$panel.removeClass('loading');
base.$panel.data('slidepanel-loaded', href);
如果您需要這裏更具體的是整個修改文件的鏈接:
http://pastebin.com/ZsiFFm52
這有效,但我還有一個問題。面板內容選項只能遠離另一個文件?不能是同一個文件的div? –
http://codebomber.com/jquery/slidepanel/是完美的,但它只加載外部文件,沒有任何選項從本地元素加載?如果是,我會評分你的答案 –
我已經添加了答案。看看這是否有幫助 –