Fork me on GitHub

Magnificent.js

A jQuery plugin for responsive zoom of images & more!

Version 2.x

Inner

<div mag-thumb="inner">
  <img src="img/alley/500x300.jpg" />
</div>
<div mag-zoom="inner">
  <img src="img/alley/1000x600.jpg" />
</div>
$host = $('[mag-thumb="inner"]');
$host.mag();

Inner Inline

<div mag-thumb="inner-inline" mag-flow="inline">
  <img src="img/alley/500x300.jpg" style="width: 400px; max-width:100%;" />
</div>
<div mag-zoom="inner-inline">
  <img src="img/alley/1000x600.jpg" />
</div>
$host = $('[mag-thumb="inner-inline"]');
$host.mag();

Outer

<div mag-thumb="outer">
  <img src="img/alley/500x300.jpg" />
</div>
<div style="width: 300px; height: 300px;">
  <div mag-zoom="outer">
    <img src="img/alley/1000x600.jpg" />
  </div>
</div>
$host = $('[mag-thumb="outer"]');
$host.mag({
  mode: 'outer',
  ratio: 1 / 1.6
});
              

Outer Drag

<div mag-thumb="outer-drag">
  <img src="img/alley/500x300.jpg" />
</div>
<div mag-zoom="outer-drag">
  <img src="img/alley/1000x600.jpg" />
</div>
$host = $('[mag-thumb="outer-drag"]');
$host.mag({
  mode: 'outer',
  position: 'drag',
  toggle: false
});

Drag

<div mag-thumb="drag">
  <img src="img/alley/500x300.jpg" />
</div>
<div mag-zoom="drag">
  <img src="img/alley/1000x600.jpg" />
</div>
$host = $('[mag-thumb="drag"]');
$host.mag({
  position: 'drag',
  toggle: false
});

Controls

<script src="src/js/mag-control.js"></script>

<div mag-thumb="controls">
  <img src="img/alley/500x300.jpg" />
</div>
<div mag-zoom="controls">
  <img src="img/alley/1000x600.jpg" />
</div>

<div mag-ctrl="controls">
  <button mag-ctrl-zoom-by="-0.5">-</button>
  <button mag-ctrl-zoom-by="0.5">+</button>
  <button mag-ctrl-move-by-y="-0.5">^</button>
  <button mag-ctrl-move-by-y="0.5">v</button>
  <button mag-ctrl-move-by-x="-0.5"><</button>
  <button mag-ctrl-move-by-x="0.5">></button>
  <button mag-ctrl-fullscreen>[ ]</button>
  <button mag-ctrl-destroy>destroy</button>
</div>
$host = $('[mag-thumb="controls"]');
$host.mag(
  toggle: false,
  position: false
);

$controls = $('[mag-ctrl="controls"]');
$controls.magCtrl({
  mag: $host
});