2009-10-16 2 views
0

저는 슬라이드 쇼 작업을하고 있는데, 그 안에 부드러운 팝업 풍선을 넣어서 마우스 오버시 더 많은 정보를 제공하고 싶습니다.슬라이드 쇼 더하기 팝업 풍선 충돌 (jQuery)

here (디자이너의 jQuery에서 영감을받은) 멋진 시스템을 사용할 때 jCarousel Lite과 결합하면 문제가있는 것 같습니다.

두 버전을 별개의 것으로 작동 시켰습니다. 문제가 혼합되어 나타날 때 실제로 나타나는지 확인하지 않아도됩니다. 가능한 모든 방법으로 CSS를 수정했는데 해결 방법이있을 수 있습니다. 나는 그것을 보지 못했습니까? 그리고 .js 파일을 다시해야한다면 ... 꽤 잃어 버릴 것입니다. 내가 지금 가지고 무엇

http://paragraphe.org/stackoverflowdemos/slide-and-bubble-standalone/image.png

: 어떤 빠른 입력을위한

Slide and bubble, separated, working

Slide and bubble incorporated, not working

감사합니다,

jCarousel 라이트 :

(function($) {           // Compliant with jquery.noConflict() 
$.fn.jCarouselLite = function(o) { 
    o = $.extend({ 
     btnPrev: null, 
     btnNext: null, 
     btnGo: null, 
     mouseWheel: false, 
     auto: null, 

     speed: 200, 
     easing: null, 

     vertical: false, 
     circular: true, 
     visible: 3, 
     start: 0, 
     scroll: 1, 

     beforeStart: null, 
     afterEnd: null 
    }, o || {}); 

    return this.each(function() {       // Returns the element collection. Chainable. 

     var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width"; 
     var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible; 

     if(o.circular) { 
      ul.prepend(tLi.slice(tl-v-1+1).clone()) 
       .append(tLi.slice(0,v).clone()); 
      o.start += v; 
     } 

     var li = $("li", ul), itemLength = li.size(), curr = o.start; 
     div.css("visibility", "visible"); 

     li.css({overflow: "hidden", float: o.vertical ? "none" : "left"}); 
     ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"}); 
     div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"}); 

     var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation 
     var ulSize = liSize * itemLength;     // size of full ul(total length, not just for the visible items) 
     var divSize = liSize * v;       // size of entire div(total length for just the visible items) 

     li.css({width: li.width(), height: li.height()}); 
     ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize)); 

     div.css(sizeCss, divSize+"px");      // Width of the DIV. length of visible images 

     if(o.btnPrev) 
      $(o.btnPrev).click(function() { 
       return go(curr-o.scroll); 
      }); 

     if(o.btnNext) 
      $(o.btnNext).click(function() { 
       return go(curr+o.scroll); 
      }); 

     if(o.btnGo) 
      $.each(o.btnGo, function(i, val) { 
       $(val).click(function() { 
        return go(o.circular ? o.visible+i : i); 
       }); 
      }); 

     if(o.mouseWheel && div.mousewheel) 
      div.mousewheel(function(e, d) { 
       return d>0 ? go(curr-o.scroll) : go(curr+o.scroll); 
      }); 

     if(o.auto) 
      setInterval(function() { 
       go(curr+o.scroll); 
      }, o.auto+o.speed); 

     function vis() { 
      return li.slice(curr).slice(0,v); 
     }; 

     function go(to) { 
      if(!running) { 

       if(o.beforeStart) 
        o.beforeStart.call(this, vis()); 

       if(o.circular) {   // If circular we are in first or last, then goto the other end 
        if(to<=o.start-v-1) {   // If first, then goto last 
         ul.css(animCss, -((itemLength-(v*2))*liSize)+"px"); 
         // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements. 
         curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll; 
        } else if(to>=itemLength-v+1) { // If last, then goto first 
         ul.css(animCss, -((v) * liSize) + "px"); 
         // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements. 
         curr = to==itemLength-v+1 ? v+1 : v+o.scroll; 
        } else curr = to; 
       } else {     // If non-circular and to points to first or last, we just return. 
        if(to<0 || to>itemLength-v) return; 
        else curr = to; 
       }       // If neither overrides it, the curr will still be "to" and we can proceed. 

       running = true; 

       ul.animate(
        animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing, 
        function() { 
         if(o.afterEnd) 
          o.afterEnd.call(this, vis()); 
         running = false; 
        } 
       ); 
       // Disable buttons when the carousel reaches the last/first, and enable when not 
       if(!o.circular) { 
        $(o.btnPrev + "," + o.btnNext).removeClass("disabled"); 
        $((curr-o.scroll<0 && o.btnPrev) 
         || 
         (curr+o.scroll > itemLength-v && o.btnNext) 
         || 
         [] 
        ).addClass("disabled"); 
       } 

      } 
      return false; 
     }; 
    }); 
}; 

function css(el, prop) { 
    return parseInt($.css(el[0], prop)) || 0; 
}; 
function width(el) { 
    return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight'); 
}; 
function height(el) { 
    return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom'); 
}; 

})(jQuery); 
01

23,516,그리고 코다 버블 플러그인 : 두 구현과

jQuery.fn.codaBubble = function(opts){ 
    var bubble = this; 
    opts = jQuery.extend({ 
     distances : [20], 
     leftShifts : [30], 
     bubbleTimes : [400], 
     hideDelays : [0], 
     bubbleWidths : [200], 
     bubbleImagesPath : "", 
     msieFix : true, 
     msiePop : true 
    },opts||{}); 
      function bubbleHtmlWrapper(bubbleHtml) { 
     return '<table class="popup" style="opacity: 0; top: -120px; left: -33px; display: none;"><tr><td class="corner topleft"/><td class="top"/><td class="corner topright"/></tr><tr><td class="left"/><td class="bubble_content">' + bubbleHtml + '</td><td class="right"/></tr><tr><td class="corner bottomleft"/><td class="bottom"><img style="display:block;" width="30" height="29" alt="" /></td><td class="corner bottomright"/></tr></table>'; 
    } 
    return jQuery(bubble).each(function (i) { 
    var bubbleHtml = jQuery('.bubble_html', this).html();  jQuery('.bubble_html', this).hide().after(bubbleHtmlWrapper(bubbleHtml));  jQuery('.popup td.bottom img', this).attr('src', opts.bubbleImagesPath + '/bubble-tail2.png'); 
    if (opts.msieFix) 
    { 
     if ($.browser.msie) 
     { 
      jQuery('.popup td.topleft').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-1.gif)'); 
      jQuery('.popup td.top').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-2.gif)'); 
      jQuery('.popup td.topright').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-3.gif)'); 
      jQuery('.popup td.left').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-4.gif)'); 
      jQuery('.popup td.right').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-5.gif)'); 
      jQuery('.popup td.bottomleft').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-6.gif)'); 
      jQuery('.popup td.bottom').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-7.gif)');    jQuery('.popup td.bottomright').css('background-image', 'url(' + opts.bubbleImagesPath + '/bubble-8.gif)');   jQuery('.popup td.bottom img').attr('src', opts.bubbleImagesPath + '/bubble-tail2.gif'); 
     } 
    } 
     var distance = opts.distances[i]; 
    var time = opts.bubbleTimes[i]; 
    var hideDelay = opts.hideDelays[i]; 
    var hideDelayTimer = null; 
    var beingShown = false; 
    var shown = false; 
    var trigger = jQuery('.trigger', this); 
    var popup = jQuery('.popup', this).css('opacity', 0); 
      jQuery([trigger.get(0), popup.get(0)]).mouseover(function() { 
     jQuery(popup).css("width", opts.bubbleWidths[i] + "px"); 
     var triggerWidth = jQuery(trigger.get(0)).css('width'); 
       if (hideDelayTimer) clearTimeout(hideDelayTimer); 
     if (beingShown || shown) { 
     return; 
     } else { 
     beingShown = true; 
      popup.css({ 
      top: -100, 
      left: opts.leftShifts[i], 
      display: 'block' 
     }) 
     .animate({ 
      top: '-=' + distance + 'px', 
      opacity: 1 
     }, time, 'swing', function() { 
      beingShown = false; 
      shown = true; 
     }); 
     } 
    }).mouseout(function() { 
     if (hideDelayTimer) clearTimeout(hideDelayTimer); 
       hideDelayTimer = setTimeout(function() { 
     hideDelayTimer = null; 
     popup.animate({ 
      top: '-=' + distance + 'px', 
      opacity: 0 
     }, time, 'swing', function() { 
      shown = false; 
      popup.css('display', 'none'); 
     }); 
     }, hideDelay); 
    }); 
    if (!opts.msiePop && $.browser.msie) 
    {  jQuery(popup).remove(); 
    } 
    });} 

답변

1

귀하의 문제는 회전 목마가 DIV과 LI의 포장 각 이미지 모두에 숨겨진 오버 플로우를 사용한다는 것입니다. 이미지 위에 마우스를 올리면 툴팁 코드가 제대로 실행되지만 툴팁이 LI 요소 위에 숨겨져있어 실제로 표시되는 툴팁을 볼 수 없습니다.

해결 방법 : 툴팁 이벤트에 BODY 태그에 툴팁을 직접 추가하고 몇 가지 jquery 기술을 사용하여 툴팁을 재배치하기 위해 이벤트를 발생시킨 LI를 찾아야합니다.

또 다른 가능성은 표시된 모든 이미지가 고정 된 축소판 크기를 갖도록하고 모든 요소에 overflow : hidden을 사용하지 않도록 할 수 있습니다. 당신이 정말로에만 회전 목마의 왼쪽과 오른쪽이 아닌 위쪽과 아래쪽을 숨길 걱정 때문이다

overflow-x: hidden; 

숨겨진 : 그런 다음 이전에 오버 플로우를 가지고 부모 DIV에 다음을 추가해야합니다. 이렇게하면 도구 설명이 LI의 양의 Y 축에 표시 될 때 제대로 표시됩니다.

편집

당신은 jCarousel JS에서이 라인을 수정할 수 있습니다 :

li.css({overflow: "hidden", float: o.vertical ? "none" : "left"}); 
div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"}); 

을 그리고 당신은 툴팁의 z 인덱스를 증가시키기위한 CSS 스타일이 있는지 확인 적어도 3까지.

+0

cballou, awesome! 감사. 나는 아직도 그것을 이해하려고 노력하고있다, 나는 (희망을 갖고) 행복한 끝을 게시하려고 노력할 것이다. – Peanuts