how to resize responsive image up and down

The website you give as an example uses CSS Transitions to make some of their images grow and shrink. You can learn more about CSS Transitions at https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions

Below is a simple example using JQuery. When you click on the Google logo it will grow and when you click on it again it will shrink.

<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <style>
    .box img {
        transition: width .4s,margin .4s,max-width .4s;
        transition-property: width, margin, max-width;
        transition-duration: 0.4s, 0.4s, 0.4s;
        transition-timing-function: ease, ease, ease;
        transition-delay: 0s, 0s, 0s;
    }
    .box img.clicked{
        width: 500px;
     }
    </style>

    <script>
    $(function(){
        $('.box img').on('click', function() {
            $(this).toggleClass('clicked');
        });
    });
    </script>
</head>
<body>
    <div class="box">
        <img src="https://www.google.com/images/srpr/logo11w.png" width="100" />
    </div>
</body>
</html>

Leave a Comment