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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:58:35+00:00 2026-06-18T04:58:35+00:00

I have a div that when clicked, causes my header’s image to shrink and

  • 0

I have a div that when clicked, causes my header’s image to shrink and resize the header. The html is as follows:

<div id="topmenu" class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <i class="icon-bar"></i>
                <i class="icon-bar"></i>
                <i class="icon-bar"></i>
            </a>

                            <a class="brand logo" href="http://www.test.com/testsite/">
                                <div id="imgsize">
                    <img src="http://www.test.com/testsite/Logo-1024x335.png" alt="Logo" />
                </div>
                            </a>

            <div id="searchicons">
                <form class="navbar-search pull-right" method="get" id="searchform" action="http://www.test.com/testsite/">
                    <input type="text" class="search-query" placeholder="Search" name="s" id="s" value="">
                </form>

                <a href="http://www.test.com/testsite/feed/" title="Subscribe to our RSS Feed" class="topmenu-social pull-right"><i class="icon-rss icon-large"></i></a>

                                    <a href="http://twitter.com/#" title="Follow us on Twitter" class="topmenu-social pull-right"><i class="icon-twitter icon-large"></i></a>

                                    <a href="http://facebook.com/#" title="Find us on Facebook" class="topmenu-social pull-right"><i class="icon-facebook icon-large"></i></a>
                                </div>
        </div>
            <nav id="nav-main" class="nav-collapse" role="navigation">
                <ul id="menu-top" class="nav"><li class="menu-about"><a href="http://www.test.com/testsite/about/">About</a></li></ul>                  
            </nav>
        <div id="toggler" class="shrink visible-desktop"><a href="#"><span id="toggler_span"><i class="icon-chevron-up"></i><br>Hide</span></a></div>
    </div>
</div>

This is my jQuery:

<script>
$(document).ready(function() {
$('#toggler').toggle(function () {
    $('#imgsize').css('max-width','230px');
    $('#toggler_span').replaceWith('<div id="toggler_span">Show<br><i class="icon-chevron-down"></i></span>');
}, function () {
    $('#imgsize').css('max-width','1024px');
    $('#toggler_span').replaceWith('<div id="toggler_span"><i class="icon-chevron-up"></i><br>Hide</span>');
});
});
</script>

The good new is the code works. But I want to add a little pizzaz to it and make it animate the resizing of the image/header.

The header’s height is determined by the image’s height which is set to auto based on the image’s width which is what gets altered with the jquery to create the resizing of the image.

I am aware of slideToggle but it won’t do anything when I apply it to my code.

Is there another method I could use?

  • 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-18T04:58:37+00:00Added an answer on June 18, 2026 at 4:58 am

    Instead of the css method try animate:

    $(document).ready(function() { 
        $('#toggler').toggle(function () { 
            $('#imgsize').animate({'max-width': '230px'}, 1000);
    
            $('#toggler_span').replaceWith('<div id="toggler_span">Show<br><i class="icon-chevron-down"></i></span>'); }, function () { $('#imgsize').animate({'max-width': '1024px'}, 1000);
    
            $('#toggler_span').replaceWith('<div id="toggler_span"><i class="icon-chevron-up"></i><br>Hide</span>'); 
        }); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a usercontrol that hides a div when a button is clicked. <asp:LinkButton
i have a div that it have image content .i wanna implement animation when
CSS3 using Webkit in Safari; I have a button that, when clicked, causes a
I have a div that, when clicked, increases in height, and vice versa. Inside
I have a DIV that changes its size when a link is clicked. When
I have a div that contains links(dynamic) and want when users clicked on a
I have a div that expands to the height of it's content. It works
I have a div that I click on to drag it. Once it's on
I have a div that will serve as container to other element, I have
I have a div that contains a list of messages (it's a chatroom application).

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.