2017-08-04 17 views
0

當任何附加的圖像被點擊(在彈出模式框中顯示)時,Swipebox jquery插件在IE7中給出錯誤。錯誤特別指出jquery.swipebox.js線:815,說:IE7中的Swipebox插件錯誤(對象不支持屬性或方法'修剪')

對象不支持屬性或方法 '修剪'

線:815代碼如下:

loadMedia : function (src, callback) { 
    // Inline content 
    if (src.trim().indexOf('#') === 0) {  // <=== Line:815 
     callback.call(...) 

回答

0

經過一番搜索,我遇到了以下解決方案,對我來說工作得非常好。

.trim() in JavaScript not working in IE

我添加下面的代碼段只是if條件之前:

if(typeof String.prototype.trim !== 'function') { 
    String.prototype.trim = function() { 
     return this.replace(/^\s+|\s+$/g, ''); 
    } 
} 
相關問題