Jump to content

How to inline a small js?


Soapa

Recommended Posts

Hi Vekia,

 

Like this 

 

<script>

 

$(document).ready(function(){$("#productsview a.btn").click(function(){if($(this).attr("rel")=="view-grid"){$("#product_list").addClass("view-grid").removeClass("view-list");}else{$("#product_list").addClass("view-list").removeClass("view-grid");}
return false;});$('.box-wishlist').hover(function(){$(this).parent().parent().find('img').addClass('XXX')},function(){$(this).parent().parent().find('img').removeClass('XXX')});});

 

</script>

 

And I put this ^ in the header.tpl file?

Link to comment
Share on other sites

if you use brackets { } in you script  you have to use also {literal} {/literal} tags

<script>

{literal}

$(document).ready(function(){$("#productsview a.btn").click(function(){if($(this).attr("rel")=="view-grid"){$("#product_list").addClass("view-grid").removeClass("view-list");}else{$("#product_list").addClass("view-list").removeClass("view-grid");}
return false;});$('.box-wishlist').hover(function(){$(this).parent().parent().find('img').addClass('XXX')},function(){$(this).parent().parent().find('img').removeClass('XXX')});});

{/literal}

</script>

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...