Could I be able to zoom in div JavaScript?

Asked By 20 points N/A Posted on -
qa-featured

Hello experts! I'm a little wary about this div in my personal webpage. I want to be able to let users zoom in particular div. Could I be able to zoom in div javascript used as a scripting language? If yes, could you please provide me with sample codes? If not, what would you suggest to accomplish this?

SHARE
Answered By 0 points N/A #154248

Could I be able to zoom in div JavaScript?

qa-featured

Hello,

You can write up codes in different ways for zooming in and out divs in a webpage. A simple code can be as shown below.

<script type="text/javascript">
<!–
    var PreferredWidth = 700;
    var PreferredHeight = 550;
    var PreferredMainContentWidth = $('div#maincontent').width();
    var PreferredBlueboxMiddleWidth = $('div.bluebox:first div.top div.middle').width();

    function zoomObject(pos,slider){
        var newWidth = Math.ceil( pos*PreferredWidth/100 );
        var newHeight = Math.ceil( pos*PreferredHeight/100 );

        if( newWidth < PreferredBlueboxMiddleWidth ) {
            $('div#maincontent, div.bluebox:first').css({'width': PreferredMainContentWidth+'px'});
            $('div.bluebox:first div.middle').css({'width': PreferredBlueboxMiddleWidth+'px'});
        } else {
            $('div#maincontent, div.bluebox:first').css({'width': (newWidth+30)+'px'});
            $('div.bluebox:first div.middle').css({'width': (newWidth)+'px'});
        }

        $("#flashobj").css({'width': newWidth+'px','height': newHeight+'px'});
    }
–>
</script>

Thank you.

Related Questions