0

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!

Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402

2 Answers2

2

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
  • 124,184
  • 33
  • 204
  • 266
  • Thank You so much. All 3 jquery functions now work at the same time. It was confusing at 1st because it worked fine on Safari & IE whereas i expected the complete opposite. –  Sep 13 '09 at 15:08
  • 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 Sep 13 '09 at 16:28
  • 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 Sep 13 '09 at 16:29
0

For debugging javascript in Firefox, Firebug is your friend.

Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402