Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE Specific Transforms... #90

Closed
stevenharman opened this issue Jul 26, 2010 · 4 comments
Closed

IE Specific Transforms... #90

stevenharman opened this issue Jul 26, 2010 · 4 comments

Comments

@stevenharman
Copy link

I'm trying to use the following mixin to generate gradients:

.gradient(@from:#fff, @to:#fff) {
  background: @from; /* for non-css3 browsers */
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='@from', endColorstr='@to');
  background: -webkit-gradient(linear, left top, left bottom, from(@from), to(@to)) no-repeat scroll 0 0 transparent; /* for webkit browsers */
  background: -moz-linear-gradient(top,  @from, @to) no-repeat scroll 0 0 transparent; /* for firefox 3.6+ */
}

however the IE specific filter-hack is causing less.js to fail with an unspecified syntax error. Is there a way to escape such a one-off rule? I've tried a few variations of kicking back to JS via ` and doing string concat, but that also fails.

Any ideas?

Also, I know that a similar issue was opened on LESS 1.x, but i'm unsure what ever happened there: https://less.tenderapp.com/discussions/problems/6-ie-specific-transformations-fail-with-less-css

@vicb
Copy link
Contributor

vicb commented Jul 26, 2010

You should look for e() and %()
i.e. filter: e(%('alpha(opacity=%d)', @alpha * 100));
I think your specific question might already have been answered in a previous issue.

@cneuharth
Copy link

Anyone able to get this to work for gradients? What I am trying to do is pass in the two gradient variables into this:

.gradient (@startcolor: #ffffff, @endcolor: #EDEDED){
background: -webkit-gradient(linear, left top, left bottom, from(@startcolor), to(@endcolor));
background: -moz-linear-gradient(top, @startcolor, @endcolor);
filter: %("progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#FFFFFF', endColorstr='#EDEDED')"); /* IE6 & IE7 /
-ms-filter: %("progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#FFFFFF', endColorstr='#EDEDED')"); /
IE8 */
}

@cneuharth
Copy link

Here is my updated code:

.gradient (@startcolor: #ffffff, @endcolor: #EDEDED){
background: ((@startcolor + @endcolor) / 2); /* Non CSS3 browsers /
background: -webkit-gradient(linear, left top, left bottom, from(@startcolor), to(@endcolor));
background: -moz-linear-gradient(top, @startcolor, @endcolor);
filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr=%d, endColorstr=%d)", @startcolor, @endcolor); /
IE6 & 7 /
-ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr=%d, endColorstr=%d)", @startcolor, @endcolor); /
IE8 */
}

@neonailol
Copy link

@newbrew
Ur filter not work
filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr=%d, endColorstr=%d)", @startcolor, @endcolor);
will make
filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFFFF, endColorstr=#00000000)";
witch is not working in ie6/7. working form of this must be like this
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#00000000');
to achieve this i change the '%' function to return (tree.Anonymus)(str) instead of quotes
and my code is
@iefilter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr=%d, endColorstr=%d)", @startcolor, @endcolor)
filter: @iefilter; /* IE6/7 /
-ms-filter: e('"'+this.iefilter.toJS()+'"'); /
IE8 */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants