views:

22

answers:

0

hi

i have made a system using which a image would be re sized according to the browser window

The example here

The code example

    function scale_down() {
        scale = 0;
        console.log(img_width + ' ' + img_height);
        scale=  ( img_width / winwidth );
              if ( ( img_height / scale) < winheight )
              {
                  $('.show_image').width('');
                $('.show_image').height(img_height / scale);

              }
              else
              {

                  scale = ( img_height / winheight );
                  $('.show_image').height('');
                  $('.show_image').width(img_width / scale);
              }
    }

The original src here and the js is in "js/original_image.js"

edit: Though it can resize every other image but not this one

Clicking on the image toggles to original size or re sized one.

Now are there any simple and better ways to do it as i m not that update with modern javascript or css techniques

thanks

Pradyut

India