Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7865883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:13:07+00:00 2026-06-03T00:13:07+00:00

I would like to fire a refresh event when the user presses the Escape

  • 0

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 



     }
    };
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:13:08+00:00Added an answer on June 3, 2026 at 12:13 am

    I would use jQuery for this. The implementation is very simple:

    $(document).keyup(function(e) {    
        if (e.keyCode == 27) { //escape key
    
            //trigger the image click logic
            $("img").trigger("click"); 
    
            //reload the page if you still need to
            window.location.reload();
        }
    });
    

    If you’re looking to trigger a postback, you should be able to use __doPostBack and override the RaisePostBackEvent method in the code-behind:

    $(document).keyup(function(e) {    
        if (e.keyCode == 27) { //escape key
            __doPostBack("<%= Page.ClientID %>", "argument");
        }
    });    
    

    And in the code-behind:

    protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument)
    {
        base.RaisePostBackEvent(source, eventArgument);
        if (source == Page)
        {
    
        }        
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to fire .example once without the user clicking .example $(document).on(click,.example,function() {
I would like to fire an event on touch when a user taps the
Using a Google Chrome Extension, I would like to fire some event or somehow
I would like to fire an event when anything on the page is clicked,
I would like a change event to fire anytime I change any property of
I would like to have a Key press of the Delete Key to fire
I would like to fire up this event: - (IBAction)profilePop:(id)sender { ProfileViewController * profile
I would like an event to fire whenever something other than a DOM element
I would like to fire an event when a specific draggable element is dropped
I would like to programmatically fire an event on a spark checkbox. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.