I would like to fire a refresh event when the user presses the “Escape” key OR would prefer to fire the image click event on pressing the Esc key
What is the best way to achieve this?
Thanks
$clone.click(function (e) { //action when magnified image is clicked on
var $this = $(this)
var imageinfo = $this.data('$relatedtarget').data('imgshell')
jQuery.imageMagnify.refreshoffsets($(window), $this.data('$relatedtarget'), imageinfo) //refresh offset positions of original and warped images
$this.stop().animate({ opacity: 0, left: imageinfo.attrs.x, top: imageinfo.attrs.y, width: imageinfo.attrs.w, height: imageinfo.attrs.h }, setting.duration,
function () {
$this.hide()
$this.data('$relatedtarget').css({ opacity: 1 }) //reveal original image
}) //end animate
}) //end click
//This is what I put in, but I'd like it to not just refresh but actually perform the same function as OnClick as above
$(document).keyup(function (e) { //action when magnified image is clicked on
if (e.keyCode == 27) { //escape key
window.location.reload();
}
}) //end click
$clone.keyup(function (e) { //action when 'Esc' key is pressed after magnifying image
if (e.keyCode == 27) { //escape key
var $this = $(this)
var imageinfo = $this.data('$relatedtarget').data('imgshell')
jQuery.imageMagnify.refreshoffsets($(window), $this.data('$relatedtarget'), imageinfo) //refresh offset positions of original and warped images
$this.stop().animate({ opacity: 0, left: imageinfo.attrs.x, top: imageinfo.attrs.y, width: imageinfo.attrs.w, height: imageinfo.attrs.h }, setting.duration,
function () {
$this.hide()
$this.data('$relatedtarget').css({ opacity: 1 }) //reveal original image
}) //end animate
}
}) //end
}
};
I would use jQuery for this. The implementation is very simple:
If you’re looking to trigger a postback, you should be able to use
__doPostBackand override theRaisePostBackEventmethod in the code-behind:And in the code-behind: