views:

332

answers:

2

I have 3 different jquery uses & put it into one code as follows:

$(function() {
    $("#ticker01").liScroll({travelocity: 0.075}); 

    $(mainContent).corner("10px");

    $(".article .thebody").hide();
    $("#mainContent .article ul")
        .prepend("<li class='readbody'><a href='' title='Read the article'>Read/Hide Story</a></li>");

    $(".actions li.readbody a").click(function(event){
        $(this).parents("ul").prev(".thebody").slideToggle("normal");

        // Stop the link click from doing its normal thing
        return false;
    }); 
});

The first one controls a scrolling news ticker, the 2nd controls rounded corners and the 3rd controls a slideToggle function. All 3 also have seperate jquery files associated to them and are linked as follows: (put BEFORE the jquery part above in the . 1st one for slidetoggle, 2nd for news ticker, 3rd for corners)

<script src="../jquery/jquery.js" type="text/javascript"></script>
<script src="../jquery/jquery.li-scroller.1.0.js" type="text/javascript"></script>
<script src="../jquery/jquery.corner.js" type="text/javascript"></script>

In Safari & IE, all 3 work fine however in FF 3.5 only the news ticker seems to work. I can't seem to get all the working at the same time in FF & i have no idea why!

A: 

For debugging javascript in Firefox, Firebug is your friend.

Tomas Lycken
+2  A: 

Is

$(mainContent).corner("10px");

supposed to be

$('#mainContent').corner("10px");

or that selector cached in a variable mainContent? The code you have posted looks ok in the context you have posted it, could you also provide the relevant HTML you are working with (ideally put a stripped version on JSBin for answerers to play with).

Russ Cam
Chris
no problem. Different browsers handle undefined variables differently, and if I recall correctly, Firefox is quite unforgiving about it and so any code after the error will not execute. IE on the other hand, is really relaxed.
Russ Cam
Oh by the way, if this solves your problem, please mark it as the "accepted" answer (click on the tick to the left of the post, underneath the vote counter).
Russ Cam