fancybox making function condition

18.03 Muhamad Akbar Bin Widayat 0 Comments

Hello guys,
I would to share about making function. You can take condition on your fancybox. In my case:
I have checkbox that should be checked to show the fancybox.

<pre>
<script type="text/javascript">
  $("#invitation-message").fancybox({
    'onStart': function()
    {
      var $list_friends = $('input[id^="friends"][type="checkbox"]:checked');
      var condition_friend = $list_friends.length
      if (condition_friend > 0) {
         alert('a')
      } else {
        alert('b')
      }  
    }  
  });
</script>
</pre>


Hopefully this article to be useful. :)

0 komentar:

terimakasih komentarnya