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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:05:22+00:00 2026-06-14T22:05:22+00:00

Hello I would like to create a zoom like animation on my page which

  • 0

Hello I would like to create a zoom like animation on my page which is working util you do not resize the window because after resize everything gets messy 🙂 .

The concept is: when you click on a link which assigned to the .click() function than with animation the left and right side of the page slides out and the middle section becomes “fullscreen” and if you click exit then left and right slides back in.

The problem with my current code is after you resized the browser and you click one of the buttons than it creats an extra effect or simply the image size animation is running after the conatiner’s animaton is finished.

And I’m stuck, I have no idea how to make it so smooth like before window resize.

in code the layout looks like this:

<!doctype html>
<html>
<head>
<style>
html, body {height:100%; padding:0; margin:0; overflow:hidden;}
#left{width:400px; height:100%; position:absolute; left:0; top:0; overflow:hidden;}
#right{width:200px; height:100%; position:absolute; right:0; top:0; overflow:hidden;}
#center{height:100%; position:absolute; left:400px; right:200px; top:0; overflow:hidden;}
</style>
</head>
<body>
<div id="left"></div>
<div id="center">
  <a href="#" onClick="return false;" class="zoom">Fullscreen</a>
  <a href="#" onClick="return false;" class="downsize">Exit</a>
  <img src="img.jpg" />
</div>
<div id="right"></div>
</body>
</html>

and the jQuery code now looks like this:

function resizeE(){
        var wWidth = $(window).width();
        var wHeight = $(window).height();
        var cWidth = $('#center').width();
        var cHeight = $('#center').height();
        var iWidth = $('#center img').width();
        var iHeight = $('#center img').height();
        var calcWidth = wHeight*1.7777;
        var iMargin = (cWidth-calcWidth)/2;
        var c2Width = wWidth-600;
        var i2Margin = (c2Width-calcWidth)/2;
        var posLeft = $('#center').position().left;
        if(posLeft == '400'){
            $('#center img').css({'height': wHeight+'px', 'width': calcWidth+'px', 'margin-left': iMargin+'px'});
        }else{
            $('#center img').css({'width': wWidth+'px', 'height': (wWidth/1.7777)+'px', 'margin-left': '0'});
        }
        $('.zoom').click(function(){
            $('.downsize').fadeIn('fast');
            $('#center img').animate({width: wWidth+'px', height: (wWidth/1.7777)+'px', marginLeft:'0'}, 1200);
            $('#center').animate({left: '0', right: '0'}, 1200);
                    $('#left').animate({marginLeft:'-400px'}, 1200);
                    $('#right').animate({marginRight:'-200px'}, 1200);
        });
        $('.downsize').click(function(){
            $('.downsize').fadeOut('fast');
            $('#center img').animate({width: calcWidth+'px', height: wHeight+'px', marginLeft: i2Margin+'px'}, 1200);
            $('#center').animate({left: '400px', right: '200px'}, 1200);
                    $('#left').animate({marginLeft:'0'}, 1200);
                    $('#right').animate({marginRight:'0'}, 1200);
        });

    }
jQuery(document).ready(function($) {
    $('.downsize').hide();
    resizeE();  
    $(window).resize(resizeE);

});
  • 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-14T22:05:23+00:00Added an answer on June 14, 2026 at 10:05 pm

    It looks like the problem is you’re adding a new click event every time you resize the browser. If you unbind the old click events at the top of resizeE it works. Here’s an updated fiddle link.

    Two lines added to the top of resizeE

    $('.downsize').off('click');
    $('.zoom').off('click');
    

    Keep in mind when you bind events via jQuery, such as .click, it doesn’t overwrite any previous events.

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

Sidebar

Related Questions

Hello I would like to create a Class which contains an array with the
Hello I would like to display an other splashscreen after the default one, if
hello i would like to know how would it be possible to create a
I would like to create the simplest (hello world package) package that I could
Hello I would like to create a program that is based on the SIP
I would like to create a web page displaying an interactive svg: since several
I would like to create some text on the stage that does not respond
I am trying to create a Socket Hello World program. I would ideally like
Hello I have a Problem with some Buttons I would like to create a
Hello I create jquery ui dialogs dynamically and would like to close them all

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.