2014-02-21 58 views
0

我想用jQuery設置backgroundSize,使用下面的代碼,並且我不斷收到第四行的錯誤:「意外標識符」。任何方式來設置jQuery的背景大小?

bigwidth = 200; 
    bigheight = 100; 
    $(e.target).css({backgroundImage: 'url(' + src + ')', 
        backgroundSize : bigwidth bigheight 
       }); 

有沒有人看到這個問題?

謝謝。

回答

2

應該backgroundSize: bigwidth + ' ' + bigheight

你需要指定參數之間的空間。

0

你的語法是錯誤的...它應該像這樣工作(通知bigwidth +' '+ bigheight):

bigwidth = 200; 
bigheight = 100; 
$(e.target).css({backgroundImage: 'url(' + src + ')', 
       backgroundSize : bigwidth +' '+ bigheight 
      }); 
相關問題