Could I be able to zoom in div JavaScript?

Asked By 20 points N/A Posted on -

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?

Answered By 0 points N/A #154248

Could I be able to zoom in div JavaScript?



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.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'});

Thank you.

Login/Register to Answer

Related Questions