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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:18:14+00:00 2026-06-12T00:18:14+00:00

Here is what i am trying to do: -When click on image, unbind the

  • 0

Here is what i am trying to do:

-When click on image, unbind the click event (on that image) and show popup.

-As long as the popup is shown, you can not click on that image.

-Once the popup is dismissed, the click event is bound again on the image.

So this is my code in order (the image is contained in li tag).

$('li').click(clickOnImage());//Bind the click event with call to clickOnImage method

function clickOnImage(){
  var id=$(this).attr("id");
  console.log('you selected image with id name: '+id);
  showWithAnimation();//Show the popup with animation
}//End function



           function showWithAnimation(){    

                   console.log('animation called');

                   $('#popup').show();



                   $("#popup").css({"top": "10%", "left": "30%"}).animate({top:(($(window).height()/2)-($('#popup').outerHeight()/2))-10}, 1000, 'easeOutBounce').show();

    //As long as the popup is shown, Unbind the click event on images
                   $('li').unbind('click');
}//End function


     function hidePopUp(){

          $('#popup').hide();
           $('li').bind('click',clickOnImage());//if popup is hidden, re-bind the click event and here is the issue!

      }//End function

I got this error in the console when running on FireFox:

Unexpected end of file while searching for selector.  Ruleset ignored due to bad selector.

I think the problem is that the function is getting called recursively. But i need to perform such approach. How can i fix that please. Thanx in advance.

  • 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-12T00:18:16+00:00Added an answer on June 12, 2026 at 12:18 am

    You are binding the click wrong. You are calling the function, not assigning it. [done in multiple places]

    $('li').click(clickOnImage());
    

    needs to needs

    $('li').click(clickOnImage);
    

    You also have the problem when you are binding to hide.

    In reality, you do not need to bind/unbind. functions. Just use the state of the element to figure out if you need to hide or show.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to display a UIView similar to this image url Click here
So I'm trying to have an effect that when you click on an image,
im trying to make it so that when i click on an image, it
I'm trying to get an image to swap on the click event of a
I'm trying to change the menu here from mouse over to a on click
Beginner here trying to get a pipeline working in bash. If somebody can see
I have one long word... p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx+wnDhlr7GqHiH6lAaPPuN5F7RjUrtvGyxxZkClJsLaTDeqg/FuJXU7RYdPQ2Ka++tfw0Z9+SRKatLUQQeCqLK8z1/V4p7BaJKPkegMzXgWGnFVmz1tdLFiYUGq0MvVgqWiepcTFmwgSd9g1pGRiCSDHJUDwcc+NidiW4/ixw4QIDAQAB ...that I am trying to fit in a
Here is the form that is inside index.php -- I'm trying to programmatically submit
Not sure what I'm doing wrong here. Just trying to make it a modal
I'm trying to add another one of these on an image click: <div class=roleoption>

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.