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 6358895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:26:49+00:00 2026-05-24T23:26:49+00:00

So I have an onclick event and then another event on the same click.

  • 0

So I have an onclick event and then another event on the same click. Basic function works like this:

1) Click image – Zoom 700%
2) Click image again – Zoom 100%
3) Click image again – Zoom 100%

I want step 3 to revert back to step 1 and then to 2 etc. Right now, it just repeats step 2 forever instead of reverting back to default.

Here is the code:

$(document).ready(function() {
    $(".zoomTarget").debug();
    $(window).resize(function(evt) {
        $(".zoomTarget").debug();
    });
    $(".zoomTarget").click(function(evt) {
        evt.stopPropagation();
        $(this).zoomTo({
            targetsize: 5.0
        }); {
            $(".zoomTarget").click(function(evt) {
                evt.stopPropagation();
                $("body").zoomTo({
                    targetsize: 1.0
                });
            });
        }
    });
    $(document).click(function(evt) {
        evt.stopPropagation();
        $("body").zoomTo({
            targetsize: 1.0
        });
    });
    $("body").zoomTo({
        targetsize: 1.0
    });
};
  • 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-05-24T23:26:50+00:00Added an answer on May 24, 2026 at 11:26 pm

    Personally I would use a boolean inside the ready function to keep track of what state I’m in, and then toggle it inside the handler:

    var zooming_in=true;
    $(".zoomTarget").click(function(evt) {
         evt.stopPropagation();
         $(this).zoomTo({
              targetsize: (zooming_in=!zooming_in)?5.0:1.0
         });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the code (inside one object) onclick: this._addX.bind(this) and then inside another object
I have a onclick event that is like: public void OnMyButton_Click(object sender, EventArgs e)
I have a div which I have attached an onclick event to. in this
I have an asp button with no onclick event but only onclientclick. This call
I have a strange problem where an onclick event on an input image is
I have a little javascript function which is attached to an onClick event of
I have an onclick function which performs several tasks. In another JavaScript function I
On Window 's load, every DD element inside Quote_App should have an onCLick event
I have a gridview control that has on onclick event bound to every cell.
I have a button. Its OnClick event calls a procedure which destroys the button,

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.