Template:NKU China/js/share

var debug = true; var igem = document.location.href.includes('https://2016.igem.org/'); //element is inner jquery, $('.auto-adjust') is middle jquery. Inner jquery is 100% embed in its parent--middle jquery. So we just need to automatically adjust middle jquery accordingly to outer jquery function auto_adjust() {

   $('.auto-adjust-inner').each(function (index, value) {
       var inner = $(value)
       var middle = inner.parent();
       var outer = middle.parent();
       var ratio = inner.width() / inner.height();
       function impl() {
           middle.width(outer.width());
           middle.height(outer.width() / ratio);
       }
       impl();
       window.addEventListener('resize', impl)
   })

}