本文介绍了Css和js在MVC中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了简单的视图并将css和js添加到其中。它工作,但当我将CSS和js添加到布局页面时它无法正常工作。



我尝试了什么:



在_Layout页面



<!DOCTYPE html>



$ / b




@ Styles.Render(〜/ Content / css)

@ Scripts.Render(〜/ bundles / modernizr)

@ Scripts.Render(〜/ Scripts / jquery-1.10.2.js)





@ Scripts.Render(〜/ Content / Metronic / global / plugins / jquery.min.js)

@ Scripts.Render(〜/ Content / Metronic / global / plugins / bootstrap / js / bootstrap.min.js)

@ Scripts.Render(〜/ Content / Metronic / global / plugins /js.cookie.min.js)

@ Scripts.Render(〜/ Content / Metronic / global / plugins / bootstrap-hover-dropdown / bootstrap-hover-dropdown.min.js )

@ Scripts.Render(〜/ Content / Metronic / global / plugins / jquery-slimscroll / jquery.slimscroll.min.js)

@ Scripts.Rend呃(〜/ Content / Metronic / global / plugins / jquery.blockui.min.js)

@ Scripts.Render(〜/ Content / Metronic / global / plugins / uniform / jquery。 uniform.min.js)

@ Scripts.Render(〜/ Content / Metronic / global / plugins / bootstrap-switch / js / bootstrap-switch.min.js)







@ Scripts.Render(〜/ Content / Metronic / global / scripts / app.min.js )



@ Scripts.Render(〜/ Content / Metronic / layouts / layout / scripts / layout.min.js)

@ Scripts.Render(〜/ Content / Metronic / layouts / layout / scripts / demo.min.js)

@ Scripts.Render(〜/ Content / Metronic / layouts / global / scripts /quick-sidebar.min.js\")

i created simple view and add css and js into it. it working , but when i add css and js into layout page its not working.

What I have tried:

In _Layout page

<!DOCTYPE html>





@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/Scripts/jquery-1.10.2.js")


@Scripts.Render("~/Content/Metronic/global/plugins/jquery.min.js")
@Scripts.Render("~/Content/Metronic/global/plugins/bootstrap/js/bootstrap.min.js")
@Scripts.Render("~/Content/Metronic/global/plugins/js.cookie.min.js")
@Scripts.Render("~/Content/Metronic/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js")
@Scripts.Render("~/Content/Metronic/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js")
@Scripts.Render("~/Content/Metronic/global/plugins/jquery.blockui.min.js")
@Scripts.Render("~/Content/Metronic/global/plugins/uniform/jquery.uniform.min.js")
@Scripts.Render("~/Content/Metronic/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js")



@Scripts.Render("~/Content/Metronic/global/scripts/app.min.js")

@Scripts.Render("~/Content/Metronic/layouts/layout/scripts/layout.min.js")
@Scripts.Render("~/Content/Metronic/layouts/layout/scripts/demo.min.js")
@Scripts.Render("~/Content/Metronic/layouts/global/scripts/quick-sidebar.min.js")

推荐答案

@Scripts.Render("~/Scripts/jquery-1.10.2.js")


@Scripts.Render("~/Content/Metronic/global/plugins/jquery.min.js")





删除其中一个,它应该是好的。



Remove one of these and it should be good to go.



这篇关于Css和js在MVC中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 07:41