Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    22
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Need help combining two scripts together

    Hello all, I've been banging my head against a wall for the past few days trying to figure out why when I add another script to my page the old one stops working. Finally I found the answer, but due to still being extremely new to javascript - and coding in general - I have not been able to successfully combine the two scripts that I have. I know it is very simple, so would someone mind either walking me thru it, or just giving me an end product to see where I was going wrong? I would really appreciate any input!

    The two scripts I have are

    Nivo slider
    Code:
     	<script type="text/javascript">
        $(window).load(function() {
            $('#slider').nivoSlider({
                effect: 'random', // Specify sets like: 'fold,fade,sliceDown'
            });
        });
        </script>
    Nav menu plugin

    Code:
     	<script type="text/javascript">
        $(document).ready(function () {
             
            $('#nav li').hover(
                function () {
                    //show its submenu
                    $('ul', this).slideDown(500);
         
                },
                function () {
                    //hide its submenu
                    $('ul', this).slideUp(300);        
                }
            );
             
        }); 
        </script>
    Last edited by jaydrones; 04-14-2012 at 04:24 AM.

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,205
    Thanks
    23
    Thanked 605 Times in 604 Posts
    Read this http://4loc.wordpress.com/2009/04/28...vs-windowload/

    I think I'd put the hover code under the $('#slider').nivoSlider({ code in $(window).load(function()


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •