javascript - Display full sized image on <img> hover? -


i have <img> in mvc 4 razor display template, , i'd display tooltip containing full sized image when user hovers on image.

html:

<img height="50" width="50" src="@model.imagestring" /> 

@model.imagestring contains image data string, looks this:

"data:image/*;base64," + convert.tobase64string(file.data) 

if couldn't guess, file.data byte[].

how can display full-sized tooltip upon hovering <img>?

here quick example: http://jsfiddle.net/bgn96/

this along lines of shan robertson suggesting.

var $tooltip = $('#fullsize');  $('img').on('mouseenter', function() {     var img = this,         $img = $(img),         offset = $img.offset();      $tooltip     .css({         'top': offset.top,         'left': offset.left     })     .append($img.clone())     .removeclass('hidden'); });  $tooltip.on('mouseleave', function() {     $tooltip.empty().addclass('hidden'); }); 

a library provides desired functionality can found here: http://cssglobe.com/lab/tooltip/02/


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -