???博客主頁:?破浪前進
??系列專欄:?Vue、React、PHP
??感謝大家點贊??收藏?評論??
文章來源:http://www.zghlxwxcb.cn/news/detail-736867.html
問題描述:上傳圖片后,圖片會變得很大,當點擊的時候更是會頂開整個的容器的高跟寬
原因:百度富文本為了呈現(xiàn)給用戶良好的使用導致沒有寫死寬高,本地多大上傳后就是多大
解決方法:在同時修改兩個文件分別在
loader.setAttribute('width','100%');//圖片寬度100%
loader.setAttribute('height','auto');//圖片高度auto
23774行(不一定)和24533(不一定),不行就搜索文章來源地址http://www.zghlxwxcb.cn/news/detail-736867.html
loadingHtml = '<img class="loadingclass" id="' + loadingId + '" src="' +
me.options.themePath + me.options.theme +
'/images/spacer.gif" title="' + (me.getLang('autoupload.loading') || '') + '" >';
successHandler = function(data) {
var link = urlPrefix + data.url,
loader = me.document.getElementById(loadingId);
if (loader) {
loader.setAttribute('src', link);
loader.setAttribute('_src', link);
loader.setAttribute('title', data.title || '');
loader.setAttribute('alt', data.original || '');
loader.setAttribute('width','100%');//圖片寬度100%
loader.setAttribute('height','auto');//圖片高度auto
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
}
};
if(json.state == 'SUCCESS' && json.url) {
loader = me.document.getElementById(loadingId);
loader.setAttribute('src', link);
loader.setAttribute('_src', link);
loader.setAttribute('title', json.title || '');
loader.setAttribute('alt', json.original || '');
loader.setAttribute('width','100%');//圖片寬度100%
loader.setAttribute('height','auto');//圖片高度auto
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
} else {
showErrorLoader && showErrorLoader(json.state);
}
到了這里,關于百度富文本上傳圖片后樣式崩塌的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!