0

画像があり、画像の任意の場所をクリックしてフルスクリーンに拡大しようとしています。ということで、画像をDIVの背景にしました。JavaScript に問題があります。具体的には、CSS をターゲットにしています。jsfiddle を使用してお知らせください。

これが私の現在の試みです:http://jsfiddle.net/Muimi/hSzq7/

$(document).ready(function (){
   $('.beforeClick').click(function (){
       $('.beforeClick').css(div#stretch'width',"33fpx");
           $(this).css(div#stretch'width',"100%");
   });
});

div#stretch{
  height: 334px;
  width: 640px;
  background-image: url(http://i.investopedia.com/inv/articles/slideshow/6-generic-products/generic-just-as-good.jpg);
}

<body>
    <div id="stretch"></div>    
</body>
4

4 に答える 4

0

このように: http://jsfiddle.net/kgkXT/ ?

$(document).ready(function (){
   $('#stretch').click(function (){
       $(this).css('width',"100%");
   });
});

そしてCSSセットで

background-size:100% auto;
于 2013-08-27T12:00:33.530 に答える