JavaScript头像 [英] JavaScript Avatar

查看:125
本文介绍了JavaScript头像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个javascript头像。 E.G与头项,主体项等等我有一个PHP脚本,查询数据库和检索头像/用户穿着的当前项目,它的响应是一个序列化的数组。
项目/头像图片位于EG中: http://blahblahblahBlah.com/graphic /itemtype/id.png

I'm trying to create a javascript avatar. E.G with Head Items, body items etc... I have a PHP script that queries the database and retrieves the current items the avatar/user is wearing, it's response is in a serialised array. The item/avatar images are in E.G: http://blahblahblahBlah.com/graphic/itemtype/id.png

提前感谢。

推荐答案

如果所有图像都在一个文件中,您有两个选择。首先,你可以把它分成许多文件。但是更好的方法是将它保存在一个文件中,然后使用一个背景图像使 div s;

例如,如果您有锤子,且尺寸为 24 * 24 ,位于 100,100 ,您会这样做。假设您有一个名为 http://blahblahblahBlah.com/character.php 的文件:

For instance, if you had a hammer, and it was sized 24 * 24, located at 100, 100 you would do this. Assuming you had a file called http://blahblahblahBlah.com/character.php:

CSS

.hammerPic {
   width: 24px; height: 24px;
   background-image: url('graphic/itemtype/id.png');
   background-position: -100px -100px;
}

HTML

<div class="hammerPic" />

这篇关于JavaScript头像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆