javascript function in layout.

Topics: Customizing Orchard, Writing themes
Nov 21, 2011 at 9:55 PM

how do I embedd a javascript function properly in the Layout.cshtml ? i.e.

<script type='text/javascript'>
    $
(function() {

        $
("#example-one").organicTabs();

        $
("#example-two").organicTabs({
           
"speed": 200
       
});

   
});
</script>


Developer
Nov 22, 2011 at 12:08 PM

For example you could...

  1. Override the Layout.cshtml in your theme if you absolutely want the script inline and there.
  2. Write the script in a separate script file (which I'd prefer) and include it. You can include it...
    1. From a view your module uses; or if you don't have a view in your module, just want to include the script, then...
    2. Take a look at how the Facebook Suite module includes a script in Filters/FacebookSuiteFilter.OnResultExecuting()