Skip to content

Conversation

@needle2k
Copy link
Contributor

Added lightBox obeserver to pause autoSlide
Added attrchange.js to js tree code by http://meetselva.github.io/ great work m8 !

works with all latest browser Chrome,FF,IE

needle2k added 3 commits June 28, 2013 12:21
added observer for lightBox overlay
to prevent autoSlide false, if lightbox is initialized

// Selector to be observed
lightBoxOpenSelector: "lbOverlay",  // lightbox overlay div
// enable/ disable observe
observeLightBoxOpen: false,
@twetzel
Copy link
Member

twetzel commented Jun 28, 2013

give me an example, because I think there is always more than 1 overlay .. dialog / modal / dropdown / etc

attrchange.js looks great! but do you realy think its needed, when that if-clause happens it should always get the actual state of the given overlay, so for what the extra listener ??

@needle2k
Copy link
Contributor Author

needle2k commented Jul 3, 2013

to observe the overlay init each time e.g you click on the image, since slider get´s init only once,
and runs into the if on init , that´s it. no further checks if there is no listener.
so how will you fetch the overlay change then ?

e.g. slimbox2.js has overlay id="lbOverlay"
there should be only one base overlay usually

<div id="lbOverlay" style="opacity: 0.8; display: none;"></div>   // base overlay

The listener fetches the change of the defined lightBoxOpenSelector style attribute

// observe lightbox init to pause autoSlide
    if (settings.observeLightBoxOpen === true) {
      $('#' + settings.lightBoxOpenSelector).attrchange(function(attrName) {
      var currentDisplay = $('#' + settings.lightBoxOpenSelector).css('display');
      if ( currentDisplay === 'block') {
          mouseEvent = true;
        } else {
          mouseEvent = false;
        }
      });
    }

similar to the mouseenter / mouseleave listener

take a look here

http://techniques.tk/

btw, is that normal that it rewinds all to restart slide process ? i thought it does it without rewind (carousel mode)

@twetzel
Copy link
Member

twetzel commented Jul 3, 2013

OK I got your point .. but I still think that is no common scenario, whats about an external pause-trigger ?

so your lightbox could send pause on open and play on close

Sorry .. I'm a bit against listener like that .. because it is a needless dependency .. or better you can also fix it without .. dont get me wrong attrchange.js looks good and fast, but it isn't needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants