A simple jQuery page preview plugin.
dist/
├── previewer.css (4 KB)
├── previewer.min.css (3 KB)
├── previewer.js (6 KB)
└── previewer.min.js (3 KB)
Four quick start options are available:
- Download the latest release.
- Clone the repository:
git clone https://github.com/fengyuanchen/previewer.git
. - Install with NPM:
npm install previewer
. - Install with Bower:
bower install previewer
.
Include files:
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<link href="/path/to/previewer.css" rel="stylesheet">
<script src="/path/to/previewer.js"></script>
// With option
$('body').previewer({
show: true
});
// With method
$('body').previewer('show');
http://example.com/?previewer
// Set previewer options
$().previewer(options);
// Change the global default options
$.fn.previewer.setDefaults(options);
- Type:
Boolean
- Default:
false
Show the preview page directly when initialize.
- Type:
String
- Default:
'phone'
- Options:
'phone'
,'tablet'
,'laptop'
,'desktop'
Preview screen type.
- Type:
Number
- Default:
480
Extra small preview screen width.
- Type:
Number
- Default:
768
Small preview screen width.
- Type:
Number
- Default:
992
Middle preview screen width.
- Type:
Number
- Default:
1200
Large preview screen width.
$().previewer('method');
Show the previewer.
Hide the previewer.
Destroy the previewer.
If you have to use other plugin with the same namespace, just call the $.fn.previewer.noConflict
method to revert to it.
<script src="other-plugin.js"></script>
<script src="previewer.js"></script>
<script>
$.fn.previewer.noConflict();
// Code that uses other plugin's "$().previewer" can follow here.
</script>
- Chrome (latest 2)
- Firefox (latest 2)
- Internet Explorer 8+
- Opera (latest 2)
- Safari (latest 2)
As a jQuery plugin, you also need to see the jQuery Browser Support.
Released under the MIT license.