我刚刚扔进一把umbraco ASP.NET CMS对我的最新项目,我不知道这是怎么了一刀切,但我的设置Knockout.js做了所有的模板.
我不是太热衷于knockout.js但是到目前为止它一直很简单,除了当我开始添加一些jQuery的东西时,我遇到的问题是jQuery在敲除之前已经完成了填充页面的所有元素.
到目前为止,唯一对我有用的解决方案是我的所有jQuery内容都包含在setTimeout()函数中,这显然是不行的.
使jQuery和Knockout协同工作的最有效方法是什么,所以jQuery在敲除之前不会完成?
我花了4个多小时试图找到一种方法来创建一个使用Compass和sass的精灵图像,它还可以自动缩放每个单独的图像以与background-size属性一起使用.
我找不到任何作品,不能相信它是那么困难.
有人有一个有效的例子吗?
编辑:这是我到目前为止
@mixin resize-sprite($map, $sprite, $percent) {
$spritePath: sprite-path($map);
$spriteWidth: image-width($spritePath);
$spriteHeight: image-height($spritePath);
$width: image-width(sprite-file($map, $sprite));
$height: image-height(sprite-file($map, $sprite));
@include background-size(ceil($spriteWidth * ($percent/100)) ceil($spriteHeight * ($percent/100)));
width: ceil($width*($percent/100));
height: ceil($height*($percent/100));
background-position: 0 floor(nth(sprite-position($map, $sprite), 2) * ($percent/100) );
}
@mixin resize-sprite-set($map, $percent, $only...) {
$name: sprite_map_name($map);
@each $sprite in sprite_names($map) {
@if length($only) == 0 or index($only, $sprite) != false {
.#{$name}-#{$sprite} {
@include resize-sprite($map, $sprite, $percent);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
mixin不会返回任何错误.
$my-icons-spacing: 10px; // give some space …Run Code Online (Sandbox Code Playgroud)