twitter-bootstrapjspspring-mvcjquery-backstretch

how to use jquery-backstretch in jsp


found this jquery plugin on available here http://www.jquery-backstretch.com/, however i would like to make use of it in my jsp page when i call the $.backstretch() method to set background image, and havent been able to... below is my code

<script>
    document.ready(function(){
       $.backstretch("/resources/imgs/WP_20170327_11_46_24_Pro.jpg");
    });
</script>

also set the resources appropriately as follows:

<mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" />

Solution

  • I tried it with jquery-backstretch v2.0.4 and it works but v2.1.5 not work.

    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.4/jquery.backstretch.min.js"></script>
    
    $.backstretch("<c:url value="/resources/imgs/arkaplan.jpg"></c:url>");
    

    Or

    $.backstretch("${pageContext.request.contextPath}/resources/imgs/arkaplan.jpg");