页面开发问题集

1.疑问拿到一个640*1136的设计图,开发中怎么高度还原?css

   在chrome中f12手机模式,选中iphone5,是320*568的,而实际上iphone5的高大上Retina屏是640*1136的分辨率,Retina屏和普屏分辨率刚好是两倍。在开发中,咱们按320*568开发便可,拿到设计稿,扔进ps里,把量到的长宽除以2就是啦。html

更多阅读:css3

http://www.zhihu.com/question/20583941?group_id=114817350web

http://www.cnblogs.com/BigPolarBear/archive/2012/03/26/2417777.htmlchrome

2.透明背景,内容文字不透明iphone

    background: rgba(255,255,255,.7); //正道!
     //background: #fff;
     //opacity: 0.7;this

   rgba中的alpha和opacity区别是什么?没错,就是不会对子元素产生影响spa

更多阅读:设计

http://kayosite.com/css3-rgba-color.htmlcode


3.新生成的元素动态绑定

错误示范:

$(document).ready(function() {
  $(".add").click(function() {

    $(this).addClass('cancel');
    $(this).removeClass('add'); 
  });
  $(".cancel").click(function() {//后来才生成的.cancel,这样是木有反应的。。。

    $(this).removeClass('cancel');
    $(this).addClass('add');
  });
});

人间正道:

$(document).ready(function() {  $(document).on("click", ".add", function() {   // code here   });  $(document).on("click", ".cancel", function() {   // code here   });});