0

I have two document.ready functions as shown below:

    $(document).ready(function() {
        $('#slider1').s3Slider({
            timeOut: 3000 
        });
    });
    $(document).ready(function() {
     $(".modalbox").fancybox();
     $("#contact").submit(function() {
    return false;
});

The first is a banner jquery that is supposed to rotate forever. The second is a contact form modal box that appears on the user's click. Is it possible for the two to coexist?

jiebo
  • 1

3 Answers3

0

Of course. You only add more handlers to ready event and all of them will fire once the ready event fires.

freakish
  • 54,167
  • 9
  • 132
  • 169
0

Totally possible. In your example it is just an overhead but you can perfectly have two subscribers to an event.

Aegis
  • 1,749
  • 11
  • 12
0
$(init);
function init(){
    banner();
    contactForm();
}
function banner(){ 
    $('#slider1').s3Slider({timeOut: 3000});
}
function contactForm(){
    $(".modalbox").fancybox();
    $("#contact").submit(...);
}
itsmikem
  • 2,118
  • 2
  • 26
  • 31