开发者

resize div zoom in zoom out using pure javascript or jquery

开发者 https://www.devze.com 2022-12-14 01:33 出处:网络
i have a page displaying a swf game within开发者_如何学JAVA a div container i need to add a zoom in zoom out slider to this page so user can resize the swf file using a slider

i have a page displaying a swf game within开发者_如何学JAVA a div container

i need to add a zoom in zoom out slider to this page so user can resize the swf file using a slider

an example like this page slider :

resize div zoom in zoom out using pure javascript or jquery

like this page http://www.agame.com/game/Snowflake-Puzzle.html

any help please

Thanks on advance


Did you look at the source? the answer is right there:

<script type="text/javascript">
<!--
    var startGameWidth = 700;
    var startGameHeight = 550;
    var startMainContentWidth = $('div#maincontent').width();
    var startBlueboxMiddleWidth = $('div.bluebox:first div.top div.middle').width();

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

        if( newWidth < startBlueboxMiddleWidth ) {
            $('div#maincontent, div.bluebox:first').css({'width': startMainContentWidth+'px'});
            $('div.bluebox:first div.middle').css({'width': startBlueboxMiddleWidth+'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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号