0

Hi I am using this script to add social media icon into my site.

<div id="menu" class="shareSelector" style="width:250px; height:250px;"></div>

$(document).ready(function () {

    $('.shareSelector').socialShare({
        social: 'facebook,google,pinterest,twitter',
        whenSelect: true,
        selectContainer: '.shareSelector'
    });

});

div gets the content upon clicking on it.Can we call this function without clicking div means on bodyload?

Regards:Ali

Amit
  • 15,217
  • 8
  • 46
  • 68
Ali
  • 835
  • 1
  • 10
  • 23

2 Answers2

3

The $(document).ready(function () {}); function should run when the page loads.

Have you got the jquery in a <script> tag?

If so, the bindings are setup by the socialShare plugin, so you may need to look at that.

What does whenSelect option do?

mishik
  • 9,973
  • 9
  • 45
  • 67
Mark Redman
  • 24,079
  • 20
  • 92
  • 147
1
$(document).ready(function () {

$('.shareSelector').socialShare({
    social: 'facebook,google,pinterest,twitter',
    whenSelect: true,
    selectContainer: '.shareSelector'
});
$('.shareSelector').click()  
});

Dont know about the socialShare plugin but you have an option there which says "whenSelect: true"

try false

deach
  • 360
  • 1
  • 2
  • 12
  • Hi deach, I tried with both of your options but unfortunately They are not working.Thanks for your response. – Ali Jul 24 '13 at 06:00