Code Snippets

2D Mode

1
2
3
4
5
6
7
8
var sg3d = new SphericalGallery(el, {
  useFullscreen:false,
  force2d:true,
  gal2d:{
    maxScale:0.75,
    distance:300
  }
});

Enable Mouse Dragging

1
2
3
var sg3d = new SphericalGallery(el, {
  useMouseDrag:true
});

Enable mouse moving mode

1
2
3
var sg3d = new SphericalGallery(el, {
  control:'mousemove'
});

Enable mouse draggin mode

1
2
3
var sg3d = new SphericalGallery(el, {
  control:'mousedrag'
});

Change general container size

1
2
3
4
5
6
var sg3d = new SphericalGallery(el, {
 mediaviewer:{
   containerWidth:500,
   containerHeight:300
 }
});

Custom AJAX processing

1
2
3
4
5
6
7
var sg3d = new SphericalGallery(el, {
 mediaviewer:{
   ajaxProcessor:function(con, req) {
     con.innerHTML = req.responseText;
   }
 }
});

Full Width

1
2
3
4
5
<style>
   .rs-sg3d {
      width:100%;
   }
</style>

Add event handlers

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sg3d.addEventListener('target', function(e) {
  console.log(e.detail);
});

sg3d.addEventListener('cload', function(e) {
  console.log(e.detail);
});

sg3d.addEventListener('cloadcomplete', function(e) {
  console.log(e.detail);
});

Create distributions

grunt dist

Build example files

grunt examples

Compile pug templates

grunt pug

Compile SASS

grunt compass

Watch files for changes

grunt watch