0

I'm currently struggling to get any of these jQuery plugins to work correctly with the views that I generated. I've tried to bundle the js/css as seen below:

bundles.Add(new ScriptBundle("~/bundles/jquery")
            .Include("~/Scripts/jquery-{version}.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.

<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>

1 Answer 1

2

Include this line into your page.

 @Styles.Render("~/Content/css/")
 @Scripts.Render("~/bundles/jquery")
Sign up to request clarification or add additional context in comments.

2 Comments

Should I reference @Styles.Render("~/Content/css") at the top of the page between the razor @{ } brackets or in the <head></head> same goes for the Scripts.Render("~/bundles/jquery") Maybe, they're not initializing in the right area of the web page.
@Styles.Render("~/Content/css") in head and @Scripts.Render("~/bundles/jquery") at the bottom of the page. You should also wrap your script with $(document).ready(function(){//your code.});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.