﻿@charset "utf-8";

//渐变
@mixin linear-gradient($color-from, $color-to, $type: vertical) {
	@if $color-from and $color-to {
		$alpha: alpha($color-to);
		@if $alpha < 1 {
			$color-rgb: change_color($color, $alpha: 1);
			background-color: $color-rgb;
		}
		@else {
			background-color: $color-to;
		}

		$ie-from: ie-hex-str($color-from);
		$ie-to: ie-hex-str($color-to);

		$webkit: 'top';
		$spec: 'to bottom';
		$ie: 0;

		@if $type == vertical {
			$webkit: 'top';
			$spec: 'to bottom';
			$ie: 0;
		}
		@if $type == horizontal {
			$webkit: 'left';
			$spec: 'to right';
			$ie: 1;
		}
		@if $type == diagonal1 {
			$webkit: '-45deg';
			$spec: '135deg';
			$ie: 1;
		}
		@if $type == diagonal2 {
			$webkit: '45deg';
			$spec: '45deg';
			$ie: 1;
		}

		background-image: -moz-linear-gradient(#{$webkit}, $color-from 0%,$color-to 100%); /* FF3.6-15 */
		background-image: -webkit-linear-gradient(#{$webkit}, $color-from 0%,$color-to 100%); /* Chrome10-25,Safari5.1-6 */
		background-image: linear-gradient(#{$spec}, $color-from 0%,$color-to 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
		-ms-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{$ie-from}', endColorstr='#{$ie-to}',GradientType=#{$ie} ); /* IE6-9 */
	}
}