Search code examples
javascriptgrailseasyslider

How can I use easyslider in grails?


how can I implement easyslider 1.7 in grails? I know that you have to include the g:javascript tags, but how do I modify the code for this part:

    <script type="text/javascript">
    $(document).ready(function(){   
        $("#slider").easySlider({
            auto: true, 
            continuous: true,
            numeric: true
        });
    }); 
    </script>

I am new to grails, and would really appreciate your help! Thanks!


Solution

  • The easiest way is to create application resources in conf/ApplicationResources.groovy.

    modules = {
        'slider_resources' {
            resource url: 'css/slider.css'
            resource url: 'js/slider.js'
        }
    }
    

    Which can be easily included in your GSP files with:

    <r:require module="slider_resources" />
    

    To use this mechanism the resources plugin needs to be installed.

    See http://grails.org/plugin/resources