后台添加新闻,在angularjs 中显示
问题:由于后台发布的图片不一定能够在手机尺寸中正常显示,解决办法,在页面加载完图片之后,对图片重现设置样式“宽度90%,居中”对齐。
//公司介绍内容 .state('companyIntroduce.company', { url: '/companyIntroduce/company', template: '<div ng-bind-html="content"></div><div id="bottom_div_show"></div>', controller: "companyIntroduceIndexCompanyController", //进入页面触发的方法 onEnter: function () { var initImgShow = function(){ var str=";line-height:1.5rem;color:#535353; width:100%;"; jQuery("img").attr("style","width:95%;padding: 0px; margin: 0 auto; border: none;display:block"); jQuery("img").attr("align","center"); jQuery("div").attr("style","padding: 0px; margin: 0px;with:95%;line-height: 1.5rem;font-size: 1rem;color:#535353;"); jQuery("p").each(function(){ var tag=jQuery(this).attr("style")==null; if(tag) { jQuery(this).attr("style",str); } else { jQuery(this).attr("style",jQuery(this).attr("style")+str); } //alert(jQuery(this).attr("style")); }); }; setTimeout(initImgShow,1000); }, })