0

I have this javascript:

<script type="text/javascript">
            $(document).ready(function () {
                $('#social-share').dcSocialShare({
                    buttons: 'twitter,facebook,linkedin,digg,stumbleupon,delicious,pinterest,buffer,print,email',
                    offsetLocation: 0,
                    center: 625,
                    floater: false
                });
                var a = $('#dcssb-1');
                buttonPosition(a);
                $(window).scroll(function () {
                    buttonPosition(a);
                });
            });
            function buttonPosition(obj) {
                var top = $(document).scrollTop();
                var p = top > 400 ? { marginTop: '20px' } : { marginTop: (400 - top) + 'px' };
                obj.css(p);
            }
</script>

When I place the code in MasterPage or in a Page which uses a Masterpage I get this error:

Object doesn't support property or method 'dcSocialShare' 

I have placed all the JS includes correctly in the the page, but when I use it without a materpage it works, why I get this error only when it's placed in the masterpage or in a page which uses a masterpage?

2
  • Are you sure the includes are loaded before the javascript which you have quoted? Commented Nov 27, 2012 at 6:51
  • What exactly do you do to "include it correctly"? Why don't you view the source of the page in the browser and make sure the <script> tag that you include the JS file is correct? Commented Nov 27, 2012 at 7:14

1 Answer 1

1

try to include your js files in asp:ScriptManager like the following

<asp:ScriptManager ID="ScriptManager1" runat="server">
    <Scripts>
        <asp:ScriptReference Path="~/jquery.js" />
    </Scripts>
</asp:ScriptManager>
Sign up to request clarification or add additional context in comments.

Comments

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.