Here are some demos of js-viewpane. Checkout the source code of this page to see details about js-viewpane-options, required css styles and its dom structure.
Install js-viewpane via bower install viewpane
and link the source code by
<script src="./bower_components/viewpane/dist/viewpane.js"></script>
Fit viewpane to largest dimensions
Fit viewpane to both dimensions
JS 3D viewpane
(opens in new tab)
CSS 3D viewpane
(opens in new tab)