Difference between revisions of "Team:BABS UNSW Australia"

Line 12: Line 12:
 
         margin-bottom:50px;
 
         margin-bottom:50px;
 
}
 
}
 +
 +
img[usemap] {
 +
border: none;
 +
height: auto;
 +
max-width: 100%;
 +
width: auto;
 +
}
  
  
Line 23: Line 30:
 
   <map name="flow1">
 
   <map name="flow1">
 
     <area href="http://www.google.com" shape="rect" coords="0,0,2226,588"
 
     <area href="http://www.google.com" shape="rect" coords="0,0,2226,588"
       alt="Flag" title="Flag - says if it safe to swim">
+
       alt="Flag" title="Test">
 
   </map>
 
   </map>
 
</div>
 
</div>
Line 30: Line 37:
 
<img src = "https://static.igem.org/mediawiki/2015/3/31/BABS_UNSW_Australia_flowchart2.jpg" style ="max-height:100%;">
 
<img src = "https://static.igem.org/mediawiki/2015/3/31/BABS_UNSW_Australia_flowchart2.jpg" style ="max-height:100%;">
 
</div>
 
</div>
 +
<script>
 +
;(function($) {
 +
$.fn.rwdImageMaps = function() {
 +
var $img = this;
 +
 +
var rwdImageMap = function() {
 +
$img.each(function() {
 +
if (typeof($(this).attr('usemap')) == 'undefined')
 +
return;
 +
 +
var that = this,
 +
$that = $(that);
 +
 +
// Since WebKit doesn't know the height until after the image has loaded, perform everything in an onload copy
 +
$('<img />').load(function() {
 +
var attrW = 'width',
 +
attrH = 'height',
 +
w = $that.attr(attrW),
 +
h = $that.attr(attrH);
 +
 +
if (!w || !h) {
 +
var temp = new Image();
 +
temp.src = $that.attr('src');
 +
if (!w)
 +
w = temp.width;
 +
if (!h)
 +
h = temp.height;
 +
}
 +
 +
var wPercent = $that.width()/100,
 +
hPercent = $that.height()/100,
 +
map = $that.attr('usemap').replace('#', ''),
 +
c = 'coords';
 +
 +
$('map[name="' + map + '"]').find('area').each(function() {
 +
var $this = $(this);
 +
if (!$this.data(c))
 +
$this.data(c, $this.attr(c));
 +
 +
var coords = $this.data(c).split(','),
 +
coordsPercent = new Array(coords.length);
 +
 +
for (var i = 0; i < coordsPercent.length; ++i) {
 +
if (i % 2 === 0)
 +
coordsPercent[i] = parseInt(((coords[i]/w)*100)*wPercent);
 +
else
 +
coordsPercent[i] = parseInt(((coords[i]/h)*100)*hPercent);
 +
}
 +
$this.attr(c, coordsPercent.toString());
 +
});
 +
}).attr('src', $that.attr('src'));
 +
});
 +
};
 +
$(window).resize(rwdImageMap).trigger('resize');
 +
 +
return this;
 +
};
 +
})(jQuery);
 +
</script>
 
</html>
 
</html>
  
 
<!--{{BABS_UNSW_Australia_Footer}}-->
 
<!--{{BABS_UNSW_Australia_Footer}}-->

Revision as of 13:46, 18 September 2015

Flag