[英]JQuery plugin/script is not working on ASP.NET MVC 5 view
I'm currently struggling to get any of these jQuery plugins to work correctly with the views that I generated. 我目前正在努力使这些jQuery插件中的任何一个都能与我生成的视图一起正常使用。 I've tried to bundle the js/css as seen below:
我试图将js / css捆绑如下所示:
bundles.Add(new ScriptBundle("~/bundles/jquery")
.Include("~/Scripts/jquery-{version}.js",
--> "~/Scripts/jquery.share.js")); ->“〜/ Scripts / jquery.share.js”));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/jquery.share.css"));
Here is the HTML and JavaScript itself. 这是HTML和JavaScript本身。
<pre>
<script type="text/javascript">
$('#mydiv').share({
networks: ['facebook', 'pinterest', 'googleplus', 'twitter', 'linkedin', 'tumblr', 'email', 'stumbleupon', 'digg'],
orientation: 'vertical',
urlToShare: 'http://www.example.com',
affix: 'left center'
});
</script>
</pre>
<div id="mydiv" class="share-affix" style="left: auto; top: 40%;">
<a class="pop share-icon-twitter" title="Share this page on Twitter" href="#" style="display: block;"></a>
<a class="pop share-icon-facebook" title="Share this page on Facebook" href="#" style="display: block;"></a>
<a class="pop share-icon-pinterest" title="Share this page on Pinterest" href="#"></a>
<a class="pop share-icon-googleplus" title="Share this page on GooglePlus" href="#"></a>
<a class="pop share-icon-linkedin" title="Share this page on LinkedIn" href="#" style="display: block;"></a>
<a class="pop share-icon-tumblr" title="Share this page on Tumblr" href="#" style="display: block;"></a>
</div>
Include this line into your page. 将此行包含到您的页面中。
@Styles.Render("~/Content/css/")
@Scripts.Render("~/bundles/jquery")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.