Jump to content

Recommended Posts

Hi

 

I'm learning jquery and i have one doubt.

 

this code that i wrote with bits from here and there works fine

but i was looking at it and it seems like missing one });

 

Is this correct? (it works...)

 

<script type="text/javascript">
    $(document).ready(function() {
        $(".thumb").thumbs();
        });
///////////
    $(window).load(function(){
        $("li").each(function(index) {
            $(this).delay(300*index).fadeIn(600);
            });
        $("img").each(function(index) {
        $(this).delay(300*index).slideDown();
        });
//////////
        $("#go3").click(function(){
            $("li").each(function(index) {
                $(this).delay(100*index).hide("slow");
                });
            /*$("#lista").animate({
            width: "70em",
            marginLeft: "0",
            }, 1500 );*/
            });
/////////
        $("#go4").click(function(){
            $("li").each(function(index) {
                $(this).delay(100*index).fadeIn(600);
                });
            });
        });
</script>

Link to comment
https://forums.phpfreaks.com/topic/238798-jquery-code-it-works-but-seems-weird/
Share on other sites

If it works then it's syntactically correct or else JS craps out and stops working altogether.  Here is your code formatted to my preference so it's easier to read:

<br />
    $(document).ready(function()<br />
    {<br />
        $(".thumb").thumbs();<br />
    });<br />
    ///////////<br />
    $(window).load(function()<br />
    {<br />
        $("li").each(function(index)<br />
        {<br />
            $(this).delay(300 * index).fadeIn(600);<br />
        });<br />
        $("img").each(function(index)<br />
        {<br />
            $(this).delay(300 * index).slideDown();<br />
        });<br />
        //////////<br />
        $("#go3").click(function()<br />
        {<br />
            $("li").each(function(index)<br />
            {<br />
                $(this).delay(100 * index).hide("slow");<br />
            });<br />
/*$("#lista").animate({<br />
            width: "70em",<br />
            marginLeft: "0",<br />
            }, 1500 );*/<br />
        });<br />
        /////////<br />
        $("#go4").click(function()<br />
        {<br />
            $("li").each(function(index)<br />
            {<br />
                $(this).delay(100 * index).fadeIn(600);<br />
            });<br />
        });<br />
    });<br />

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.