I have an MVC4 application that I made into a Single Page Application that loads partial views into the _Layout.cshtml using Backbone.js's ajax-style Routers.
One of the partial views makes use of a js plugin. I need to initialize the plugin after the partial view loads. How does one do this?
I've loaded the plugin into _Layout.cshtml but when I load the partial view the following code does not load the file that initializes the plugin ("scrollBar.js")
in _Layout.cshtml (load all the plugin's dependencies):
in Partial View (load js file that initializes the plugin):Code:<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui-1.8.18.custom.min.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.easing.1.3.js")"></script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.mousewheel.min.js")"></script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.mCustomScrollbar.js")"></script> @RenderSection("Javascript", false)
Checking in firefox inspect element, the script "scrollBar.js" is not loaded with the partial view. Further more once it does I need it to initialize the plugin to some element in the DOM.Code:@section Javascript{ <script type="text/javascript" src="@Url.Content("~/Scripts/scrollBar.js")"></script> }
Any help would be much appreciated.




Reply With Quote