IE conditional comments

137 views
Skip to first unread message

dem...@googlemail.com

unread,
Jul 3, 2009, 10:49:17 AM7/3/09
to Haml
Hi!

I would like to do something like the following:

<!--[if !IE]> -->
<a href="http://www.frame-concept.de/logica.html"
params="lightwindow_width=640,lightwindow_height=375"
class="lightwindow"><img src="images/logica.jpg" alt="Player"
border="0" />
<!-- <![endif]-->
<!--[if IE]>
<a onclick="var w=window.open
(this.href,'Video_4159','width=640,height=375,left=0,top=0,scrollbars=no');w.focus
();return false;" href="http://www.frame-concept.de/logica.html"><img
src="images/logica.jpg" alt="Player" longdesc="images/
Leistungen_klein.jpg" border="0" />
<![endif]-->

How would i do that with haml?

Nathan Weizenbaum

unread,
Jul 3, 2009, 1:48:33 PM7/3/09
to ha...@googlegroups.com
You would need to use a helper in that case.

grimen

unread,
Jul 4, 2009, 2:17:00 AM7/4/09
to Haml
I just felt to refactor this bit while trying to answer your question:

Something like this (with HAML/jQuery):

%head
// << other stuff >>

/[if IE]
:javascript
$(document).ready(function() {
jQuery('a[rel="external"]').click(function() {
var w = window.open($(this).attr('href'), $(this).attr
('id'), 'width=640,height=375,left=0,top=0,scrollbars=no');
w.focus();
return false;
}
});
%body
%a{:href => "http://www.frame-concept.de/logica.html", :rel =>
'external', :id => 'Video_4159'}
%img{:src => 'images/logica.jpg', :alt => 'Player', :longdesc =>
'images/Leistungen_klein.jpg', :border => '0'}



grimen

On Jul 3, 4:49 pm, "demo...@googlemail.com" <demo...@googlemail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages