起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2544|回复: 5

[处理中3] 关于图片样式

[复制链接]

88

主题

464

帖子

763

积分

高级会员

Rank: 4

积分
763
QQ
发表于 2017-6-6 00:44:38 | 显示全部楼层 |阅读模式
本帖最后由 q2045377 于 2017-6-6 01:12 编辑

图片外面套了一个固定大小div,我想让图片居中溢出隐藏。
Model.prototype.image15Unload = function(event){
        this.getElementByXid('image15').style.marginTop = (parseInt(this.getElementByXid('image15').parentNode.style.height) - t.height)/2 + 'px';
        this.getElementByXid('image15').style.marginLeft = (parseInt(this.getElementByXid('image15').parentNode.style.width) - t.width) /2 + 'px'

        };

Model.prototype.image15Unload = function(event){        this.style.marginTop = (parseInt(this.parentNode.style.height) - this.height)/2 + 'px';
        this.style.marginLeft = (parseInt(this.parentNode.style.width) - this.width) /2 + 'px'


        };


怎么无效哈  试了几次               但是在txt自己测试有效onload="this.style.marginTop = (parseInt(this.parentNode.style.height) - this.height)/2 + 'px';this.style.marginLeft = (parseInt(this.parentNode.style.width) - this.width) /2 + 'px'"      

有没有好的解决方法  关于图片溢出隐藏 居中显示呢   
发表于 2017-6-6 10:37:02 | 显示全部楼层
image15Unload   这个方法确定执行了吗??
你alert 或者debugger 调试下看看吧!

本地测试 img的 Load 方法是不会执行的!

你可以在model组件的onLoad中写代码实现!

关于组件样式的修改:
http://docs.wex5.com/wex5-ui-question-list-2073/
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

88

主题

464

帖子

763

积分

高级会员

Rank: 4

积分
763
QQ
 楼主| 发表于 2017-6-6 12:10:01 | 显示全部楼层
本帖最后由 q2045377 于 2017-6-6 12:34 编辑
liangyongfei 发表于 2017-6-6 10:37
image15Unload   这个方法确定执行了吗??
你alert 或者debugger 调试下看看吧!

源码里写可用    只是为嘛上调的太多   
微信截图_20170606121117.png
微信截图_20170606121504.png
回复 支持 反对

使用道具 举报

发表于 2017-6-6 14:25:58 | 显示全部楼层
q2045377 发表于 2017-6-6 12:10
源码里写可用    只是为嘛上调的太多

啥意思??
上调的太多   ???
没明白你想表达什么??


源码里写可用  ,那你就在源码中写呗!如果非要在js中写!建议在model的onLoad中写代码调用!
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

88

主题

464

帖子

763

积分

高级会员

Rank: 4

积分
763
QQ
 楼主| 发表于 2017-6-6 14:45:29 | 显示全部楼层
liangyongfei 发表于 2017-6-6 14:25
啥意思??
上调的太多   ???
没明白你想表达什么??

是说   图片咋没居中
回复 支持 反对

使用道具 举报

发表于 2017-6-6 16:11:36 | 显示全部楼层
q2045377 发表于 2017-6-6 14:45
是说   图片咋没居中

看上去就是自上而下的流式布局
样式问题自己调吧!
http://jingyan.baidu.com/article/c33e3f48a3615dea15cbb512.html


qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-9-24 08:21 , Processed in 0.062831 second(s), 31 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表