SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery and lghtbox conflicti

    On my page I have lightbox effect for my photos. On same page I have included news ticker which is based od jquery, and since ticker is loaded lightbox is not working. I found this http://docs.jquery.com/Using_jQuery_...ther_Libraries
    which need's to be solution for my problem but I cannot figure how. When I add jQuery.noConflict(); method I have lightbox effect loaded but my news ticker is not working. If anyone have solution please post it.
    Thanks

  2. #2
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After you use jQuery.noConflict() you need to change your jQuery calls.

    Basically, what that does is relinquish control over the factory call ($) so you now need to write your calls:

    jQuery("#someID").doWhatever()

    instead of

    $("#someID").doWhatever()

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've changed jquery calls but the problem is still present. My news ticker doesn't working.
    Here's the code I use
    Code:
    <script type="text/javascript" >
    
    jQuery.noConflict();
    
    
    var newsitems;
    var curritem=0;
    var iPause=0;
    
         
    
    
    
    jQuery(document).ready(function(){
        var tickerSelector = "ul#ticker li";
        newsitems = $(tickerSelector).hide().hover(
            function(){
                jQuery(this).addClass("hovered");
                iPause=1;
            },
            function(){
                jQuery(this).removeClass("hovered");
                iPause=0;
            }
        ).filter(":eq(0)").show().add(tickerSelector).size();
        setInterval(ticknews,4000); //time in milliseconds
    });
    
    
    function ticknews() {
      if (iPause==0){
        jQuery("#ticker li:eq("+curritem+")").fadeOut("slow",function(){$(this).hide();});
        curritem = ++curritem&#37;newsitems;
        jQuery("#ticker li:eq("+curritem+")").fadeIn("slow");
        }
    }
    
    
    </script>

  4. #4
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You missed out one of the dollar signs.

    jQuery("#ticker li:eq("+curritem+")").fadeOut("slow",function(){$(this).hide();});
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's helped.
    Thanks a lot.


Bookmarks

Posting Permissions

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