博客 (152)

Apple’s newest devices feature the Retina Display, a screen that packs double as many pixels into the same space as older devices. For designers this immediately brings up the question, “What can I do to make my content look outstanding on these new iPads and iPhones?”. First there are a few tough questions to consider, but then this guide will help you get started making your websites and web apps look amazingly sharp with Retina images!

retina image comparison

Things to Consider When Adding Retina Images

The main issue with adding retina images is that the images are double as large and will take up extra bandwidth (this won’t be an issue for actual iOS apps, but this guide is covering web sites & web apps only). If your site is mostly used on-the-go over a 3G network it may not be wise to make all your graphics high-definition, but maybe choose only a select few important images. If you’re creating something that will be used more often on a WI-FI connection or have an application that is deserving of the extra wait for hi-res graphics these steps below will help you target only hi-res capable devices.

Simple Retina Images

The basic concept of a Retina image is that your taking a larger image, with double the amount of pixels that your image will be displayed at (e.g 200 x 200 pixels), and setting the image to fill half of that space (100 x 100 pixels). This can be done manually by setting the height and width in HTML to half the size of your image file.

<img src="my200x200image.jpg" width="100" height="100">

If you’d like to do something more advanced keep reading below for how you can apply this technique using scripting.

Creating Retina Icons for Your Website

When users add your website or web app to their homescreen it will be represented by an icon. These sizes for regular and Retina icons (from Apple) are as follows:
ios icon samples

iPhone 57 x 57
Retina iPhone 114 x 114
iPad 72 x 72
Retina iPad 144 x 144

For each of these images you create you can link them in the head of your document like this (if you want the device to add the round corners remove -precomposed):

<link href="touch-icon-iphone.png" rel="apple-touch-icon-precomposed" />
<link href="touch-icon-ipad.png" rel="apple-touch-icon-precomposed" sizes="72x72" />
<link href="touch-icon-iphone4.png" rel="apple-touch-icon-precomposed" sizes="114x114" />
<link href="touch-icon-ipad3.png" rel="apple-touch-icon-precomposed" sizes="144x144" />

If the correct size isn’t specified the device will use the smallest icon that is larger than the recommended size (i.e. if you left out the 114px the iPhone 4 would use the 144px icon).

Retina Background Images

Background images that are specified in your CSS can be swapped out using media queries. You’ll first want to generate two versions of each image. For example ‘bgPattern.png’ at 100px x 100px and ‘bgPattern@2x.png’ at 200px x 200px. It will be useful to have a standard naming convention such as adding @2x for these retina images. To add the new @2x image to your site simply add in the media query below (You can add any additional styles that have background images within the braces of the same media query):

.repeatingPattern {
     background: url(../images/bgPattern.png) repeat;
     background-size: 100px 100px;
}

@media only screen and (-webkit-min-device-pixel-ratio: 2) {
     .repeatingPattern {
          background: url(../images/bgPattern@2x.png) repeat;
     }
}

JavaScript for Retina Image Replacement

For your retina images that aren’t backgrounds the best option seems to be either creating graphics with CSS, using SVG, or replacing your images with JavaScript. Just like the background images, you’ll want to create a normal image and one ‘@2x’ image. Then with JavaScript you can detect if the pixel ratio of the browser is 2x, just like you did with the media query:

if (window.devicePixelRatio == 2) {

//Replace your img src with the new retina image

}

If you’re using jQuery you could quickly replace all your images like this very basic example below. It’s a good idea to add a class to identify the images with hi-res versions so you don’t replace any others by mistake. I’ve added a class=”hires” for this example. Also make sure you have the standard (non-retina) image height and width set in the HTML:

<img class="hires" alt="" src="search.png" width="100" height="100" />
<script type="text/javascript">
$(function () {

	if (window.devicePixelRatio == 2) {

          var images = $("img.hires");

          // loop through the images and make them hi-res
          for(var i = 0; i < images.length; i++) {

            // create new image name
            var imageType = images[i].src.substr(-4);
            var imageName = images[i].src.substr(0, images[i].src.length - 4);
            imageName += "@2x" + imageType;

            //rename image
            images[i].src = imageName;
          }
     }

});
</script>

Server-Side Retina Images

If you’d like to implement a server-side retina image solution, I recommend checking out Jeremy Worboys’ Retina Images (which he also posted in the comments below). His solution uses PHP code to determine which image should be served. The benefit of this solution is that it doesn’t have to replace the small image with the retina one so you’re using less bandwidth, especially if you have lots of images that you’re replacing.

Website Optimization for Retina Displays

If you’re looking for additional information on creating Retina images, I’ve recently had a short book published called Website Optimization for Retina Displays that covers a range of related topics. It contains some of what is above, but also includes samples for many different situations for adding Retina images. It explains the basics of creating Retina images, backgrounds, sprites, and borders. Then it talks about using media queries, creating graphics with CSS, embedding fonts, creating app icons, and more tips for creating Retina websites.

K
转自 Kyle Larson 13 年前
4,393

版本区别

功能特性 Windows RT Windows 8
(标准版)
Windows8 Pro
(专业版)
Windows 8 Enterprise
(企业版)
与现有Windows 兼容
购买渠道 在设备上预装 大多数渠道 大多数渠道 经过认证的客户
架构 ARM (32-bit) IA-32 (32-bit) or x86-64 (64-bit) IA-32 (32-bit) or x86-64 (64-bit) IA-32 (32-bit) or x86-64 (64-bit)
安全启动
图片密码
开始界面、动态磁帖以及相关效果
触摸键盘、拇指键盘
语言包
更新的资源管理器
标准程序
文件历史
系统的重置功能
Play To “播放至”功能
Connected standby保持网络连接的待机
Windows Update
Windows Defender
增强的多显示屏支持
新的任务管理器
ISO 镜像 and VHD 挂载
移动通信功能
Microsoft 账户
Internet Explorer 10
SmartScreen
Windows 商店
Xbox Live 程序 (包括 Xbox Live Arcade)
Exchange ActiveSync
快速睡眠(snap)
VPN连接
Device encryption
随系统预装的Microsoft Office
桌面 部分
储存空间管理(storage space)
Windows Media Player
Windows Media Center 需另行添加
远程桌面 只作客户端 只作客户端 客户端和服务端 客户端和服务端
从VHD启动
BitLocker and BitLocker To Go
文件系统加密
加入Windows 域
组策略
AppLocker
Hyper-V 仅64bit支持
Windows To Go
DirectAccess
分支缓存(BranchCache)
以RemoteFX提供视觉特效
Metro风格程序的部署

下载地址

根据下面的 SHA1 或文件名在网上搜索下载地址,下载完成后验证其 SHA1 即可。

Windows 8 (x86) - DVD (Chinese-Simplified)
文件名: cn_windows_8_x86_dvd_915414.iso
SHA1: 0C4A168E37E38EFB59E8844353B2535017CBC587


Windows 8 (x64) - DVD (Chinese-Simplified)
文件名: cn_windows_8_x64_dvd_915407.iso
SHA1: A87C4AA85D55CD83BAE9160560D1CB3319DD675C


Windows 8 Pro VL (x86) - DVD (Chinese-Simplified)
文件名: cn_windows_8_pro_vl_x86_dvd_917720.iso
SHA1: EEEF3C3F6F05115C7F7C9C1D19D6A6A6418B5059


Windows 8 Pro VL (x64) - DVD (Chinese-Simplified) 推荐
文件名: cn_windows_8_pro_vl_x64_dvd_917773.iso
SHA1: 9C4EC9FC4FB561F841E22256BC9DEA6D9D6611FF


Windows 8 Enterprise (x86) - DVD (Chinese-Simplified)
文件名: cn_windows_8_enterprise_x86_dvd_917682.iso
SHA1: 951565D8579C5912FB4A407B3B9F715FBDB77EFE


Windows 8 Enterprise (x64) - DVD (Chinese-Simplified)
文件名: cn_windows_8_enterprise_x64_dvd_917570.iso
SHA1: 1280BC3A38A7001FDE981FA2E465DEB341478667

激活方式

目前流行 KMSmicro 激活,写此文时的最新版本是 4.0,下载地址网上搜之(或联系我)。

5,845
下载最新版 Visual Studio 请点击这里:http://xoyozo.net/Software/Visual_Studio

 

离 VS2012 发布已经过去一年了,我觉得还是有必要把它的一些信息写下来,特别是下载和注册方式,方便日后查看。我关心的依旧是 Ultimate 版本。

VS2012_ULT_chs.iso 是 Windows 下载中心的 Trial 版 (需要序列号,网上有很多)

这里推荐 MSDN 版(无需序列号,没有使用期限):

Visual Studio Ultimate 2012 (x86) - DVD (Chinese-Simplified)

文件名:cn_visual_studio_ultimate_2012_x86_dvd_920954.iso

SHA1:C01EEF4C6B10F654257748197F3A8E50B2BFD58B

有了用这个 SHA1 去网上搜一下,就可以看到一大堆下载地址,譬如:

ed2k://|file|cn_visual_studio_ultimate_2012_x86_dvd_920954.iso|1643802624|A3058CE4F2AD7035DB6E67586D07AAA5|/
 

10,933
下载最新版 Visual Studio 请点击这里:http://xoyozo.net/Software/Visual_Studio

 

前日(2010年4月12日),微软正式发布了 Microsoft Visual Studio 2010,相信这是个让众多微软开发者们心情激动的一天吧。至于 VS是啥米东东之类的就不再解释了,相关人员请移步维基百科

 

微软称 Visual Studio 2010 集成开发环境(IDE)的界面被重新设计和组织,变得更加清晰和简单。新的 IDE 更好的支持了多文档窗口以及浮动工具窗,并且对于多显示器的支持也有所增强。IDE的外壳使用 WPF 重写,内部使用 MEF 重新设计,以提供比先前版本更好的扩展性。

版本说明

VS2010 的版本较之前版本有所不同,取消了标准版、团队版命名方式等,而采用跟 Window 7 一致的:

产品功能 Professional (专业版) Premium (高级版) Ultimate (旗舰版)
测试和诊断
测试工具
集成开发环境
数据库开发
开发平台支持
体系结构和建模 ×
Lab Management × ×
Team Foundation Server
MSDN 订阅
价格 $1,199 $5,469 $11,899

(注:√ 支持 × 不支持 ≈ 部分支持)

旗舰版下载地址(官方简体中文版)

“只选贵的”符合天朝国情。许多大侠认为官方下载的肯定是未破解的,那是您的错,其实微软也是一只河蟹,记住一个公式:Trial(测试版)+ Key(序列号)= 正式版

分卷下载:(下载后双击part1.exe解压为 VS2010UltimTrial.iso)
VS2010UltimTrialCHS_4PartsTotal.part1.exe 官网下载 迅雷下载
VS2010UltimTrialCHS_4PartsTotal.part2.rar 官网下载 迅雷下载
VS2010UltimTrialCHS_4PartsTotal.part3.rar 官网下载 迅雷下载
VS2010UltimTrialCHS_4PartsTotal.part4.rar 官网下载 迅雷下载
完整镜像下载: X16-60997VS2010UltimTrialCHS.iso 官网下载 迅雷下载
CRC: 0x3DB619A0
SHA-1: 0x8BA7308E1F74AEE8DE6094CE04F78CD21486608D

旗舰版下载地址(官方英文版)

分卷下载:(下载后双击part1.exe解压为 VS2010UltimTrial.iso)
VS2010UltimTrial_4PartsTotal.part1.exe 官网下载 迅雷下载
VS2010UltimTrial_4PartsTotal.part2.rar 官网下载 迅雷下载
VS2010UltimTrial_4PartsTotal.part3.rar 官网下载 迅雷下载
VS2010UltimTrial_4PartsTotal.part4.rar 官网下载 迅雷下载
完整镜像下载: X16-42552VS2010UltimTrial1.iso 官网下载 迅雷下载
CRC: 0x8095c67f
SHA-1: 0x8371f6a8d090063fcc320617e94854374633df3c

关心的话题

钥匙:YCFHQ-9DWCY-DKV88-T2TMH-G7BHP(需刮开才能看到,显示器刮坏请找经销商)

39,138
Enumerable.First 方法

返回序列中的第一个元素。

Enumerable.FirstOrDefault 方法

返回序列中的第一个元素;如果序列中不包含任何元素,则返回默认值。

Enumerable.Single 方法

返回序列的唯一元素;如果该序列并非恰好包含一个元素,则会引发异常。

Enumerable.SingleOrDefault 方法

返回序列中满足指定条件的唯一元素;如果这类元素不存在,则返回默认值;如果有多个元素满足该条件,此方法将引发异常。

xoyozo 16 年前
5,232
网页可见区域宽:document.documentElement.clientWidth  
网页可见区域高:document.documentElement.clientHeight  
网页可见区域宽:document.documentElement.offsetWidth (包括边线的宽)  
网页可见区域高:document.documentElement.offsetHeight (包括边线的宽)  
网页正文全文宽:document.documentElement.scrollWidth  
网页正文全文高:document.documentElement.scrollHeight  
网页被卷去的高:document.documentElement.scrollTop  
网页被卷去的左:document.documentElement.scrollLeft  
网页正文部分上:window.screenTop  
网页正文部分左:window.screenLeft  
屏幕分辨率的高:window.screen.height  
屏幕分辨率的宽:window.screen.width  
屏幕可用工作区高度:window.screen.availHeight  
屏幕可用工作区宽度:window.screen.availWidth
4,604

PNG半透明背景图片效果
PNG图片在网页设计中扮演着一个很重要的角色,利用PNG图片的特点可以制作出实用,绚丽的效果,可是对于PNG图片的支持却不是很理想,Firefox和Opera对PNG支持的比较好,特别是Firefox浏览器。可是IE却不理PNG,使得设计者无法很随意的使用png图片。

IE5.5+的AlphaImageLoader滤镜为通向png提供了一个道路,如果他载入的是PNG(Portable Network Graphics)格式,则0%-100%的透明度也被提供。我们就利用这个滤镜和hack来设计一个半透明png背景图片的模型

这里是个超链接测试

(X)HTML: <div id="wrap">
<p><a href="http://www.jluvip.com"><strong>PNG半透明背景图片效果</strong></a><br />:PNG图片在网页设计中扮演着一个很重要的角色,利用PNG图片的特点可以制作出需要使用绚丽的效果,可是对于PNG图片的支持却不是很理想,Firefox和Opera对PNG支持的比较好,特别是Firefox浏览器。可是IE却不理PNG,是的设计者无法很随意的使用png图片。</p>
<p>IE5.5+的AlphaImageLoader滤镜为通向png提供了一个道路,如果他载入的是PNG(Portable Network Graphics)格式,则0%-100%的透明度也被提供。我们就利用这个滤镜和hack来设计一个半透明png背景图片的模型
</p>
<p><a class="test" href="http://www.jluvip.com">这里是个超链接测试</a></p>
CSS: #wrap{ width:460px;margin:20px auto 20px 80px;text-align:left;height:300px; padding:20px; border:1px #eee solid;}
/*not for ie 6.0*/
html>body #wrap{background: url(img/bgcanvas.png) repeat;}
/*for ie 6.0*/
* html #wrap {
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src="img/bgcanvas.png");
background:none;
}
#wrap a{color:#c00; text-decoration: none; position:relative;}/*解决IE下链接失效的问题*/
#wrap a:hover{ text-decoration:underline;}

nbsp;

观看效果

3,744
代码
<INPUT onfocus="oRng=this.createTextRange();oRng.collapse(true);oRng.moveStart('character',3);oRng.select()" value=abcdefg type=text name=text1>
效果

当焦点移至文本框时光标定位在位置3。

补充

如果要直接定位在文本末尾,把上面的数字 3 改为 this.value.length 即可。

xoyozo 17 年前
5,052

代码:

<input type="text" name="re_name" style="width: 100px; height: 21px; font-size: 10pt;" /><span
style="width: 18px; border: 0px solid red;">
<select name="r00" style="margin-left: -101px; width: 118px; background-color: #FFEEEE;"
onchange="document.all.re_name.value=this.value;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</span>

 

说明:

该代码兼容性非常差,在XHTML文档中或在非IE浏览下浏览均不能达到预期效果,原因可能是它们的 select 元素的 z-index 太高,并且 css 定位方式不同,部署于应用还需改进代码。

xoyozo 17 年前
5,216

方法:
   alert,对话框,OK按钮
   confirm,对话框,OK和Cancel按钮
   prompt,对话框,可输入
   close,关闭当前浏览器窗口
   navigate,在当前窗口中导航到指定的URL资源
   setInterval,设置每隔一定时间调用指定程序代码,毫秒,setInterval("Func()",5000)
   setTimeout,设置经过一定时间后执行一次指定程序代码,毫秒,setTimeout("Func()",5000)
   clearInterval,
   clearTimeout,
   moveTo,将浏览器窗口移动到屏幕上的某个位置
   resizeTo,改变浏览器窗口的大小
   open,打开一个新窗口 window.open("abc.html","_blank","top=0,left=0,width=100,height=200,toolbar=no");
   showModalDialog产生一个模态对话框
   showModelessDialog产生一个非模态对话框窗口
属性:
    closed
    opener
    defaultstatus
    status
    screenTop
    screenLeft
事件:
    onload,onunload,onmouseover,...
对象属性:
    location对象:设置和返回当前网页的URL信息。
        载入一个新的网页:window.location.href="http://g.cn";
        刷新当前页:window.location.reload();
    event对象:获取和设置当前事件的有关信息。
        altKey属性,用于检测事件发生时Alt键是否被按下
        ctrlKey。。。
        shiftKey...
        screenX,screenY设置和返回鼠标相对屏幕顶点的x,y坐标
        offsetX,offsetY设置和返回鼠标相对事件源顶点的x,y坐标
        x,y 设置和返回鼠标相对事件源的父元素顶点x,y坐标
        returnValue设置和返回事件的返回值,一般情况下设置为false
        cancelBubble设置和返回当前事件是否继续向下传递
        srcElement设置和返回事件源对象
        keyCode设置和返回键盘按下或弹起时的键的unicode码
        button检索鼠标动作使用的是哪个按键,1左鍵,2右键,3左右同时
function window_onkeypress()
{
//    alert(window.event.keyCode);
    if(window.event.keyCode==27)
    {
        window.close();
    }
}

xoyozo 17 年前
4,924