KevinBatdorf / liquidslider

A Responsive jQuery Content Slider
161 stars 63 forks source link

Cannot call method 'split' of undefined #45

Closed creativereason closed 11 years ago

creativereason commented 11 years ago

Just getting started trying to use liquid slider to replace a custom slider and after setting up my basic demo on my own code (with a bunch of legacy css, hence the classes in here):

  <div class="liquid-slider"  id="slider-id">
    <div id="image-1" class="img-wrapper">          
           <!--other stuff-->
          <img class="slide active" src="img/issue-1/image-item.jpg" id="draped1" />
    </div>
   <div id="image-2" class="img-wrapper">...</div>
</div>

I'm getting a error in the getHeight function. It's saying this is undefined:

  currentPanelHeight = height || $($(self.panelContainer).children()[self.panelHeightCount]).css('height').split('px')[0];

Could be a problem with my CSS during the transition, but wasn't sure if we should check to see if $(self.panelHeightCount).length > 0 or something there?

KevinBatdorf commented 11 years ago

Do you have a link? There are a few reasons that error would occur.

Checking it would just simply not throw the error and the slider would still not work. Otherwise a good idea though.

creativereason commented 11 years ago

No link yet, just playing around locally still trying to see if it fits my needs.

My JS call (in document.ready) is this: $('#slider-id').liquidSlider({ dynamicTabs: false, keyboardNavigation: true, hashNames: true, autoHeight: false, });

Tried autoHeight to see if made a difference. I had an existing image loader I'm going to disable to see if it makes a difference.

Do I need to explicitly set a height & width for the liquid-slider class in CSS?

KevinBatdorf commented 11 years ago

Are you using a custom build?

creativereason commented 11 years ago

No pulled the latest from Github.

KevinBatdorf commented 11 years ago

What does your markup look like? It could be a typo in the markup or a missing closing tag somewhere that the browser hasn't caught.

creativereason commented 11 years ago

It's really crazy, messy because of the site it's on (magazine with a lot of image of image overlays) so there are extra divs inside the panel container. Maybe that's causing the problem?

The code is generated from PHP so this is pulled from firebug:

```


Sorry for poor formatting...
KevinBatdorf commented 11 years ago

I see a few things not working properly.

The element id="mks" isnt being added as it's own slide. Is this within the Liquid Slider container? Also, the top and left positioning might be throwing it off, but you can position the slider wrapper with these instead. I'm assuming another plugin is manipulating that though.

Can you post the markup in your html?

It should be something like:

<div class="liquid-slider"  id="slider-id">
        // One slide is within these divs
        <div>
            <?php # content goes in here ?>
        </div>
</div>
creativereason commented 11 years ago

Yes, the mks is inside the it just looks like it from that paste above... here's my code (with calls to PHP functions:

<div class="liquid-slider"  id="slider-id">
  <div id="image-1" class="img-wrapper">          
      <?php addLink('http://mylink/10jSvRc', 712, 354, 25, 89, 'draped1', 'michael-jacob', false);?>            
      <?php addLink('http://mylink/13kKqkq', 474, 868, 19, 74, 'draped1', 'mks', false);?>                                      
      <img class="slide active" src="img/issue-1/draped-in-nostalgia-01-small.jpg" id="draped1" />
  </div>
  <div id="image-2" class="img-wrapper">
      <img class="slide" src="img/issue-1/draped-in-nostalgia-02-small.jpg" style="display: none;" id="draped2" />
  </div>
  <div id="image-3" class="img-wrapper">
      <?php addLink('http://mylink/13kKqkq', 658, 162, 21, 66, 'draped3', 'mks-2');?>                                   
      <?php addLink('http://mylink/15468fD', 678, 418, 16, 90, 'draped3', 'lulu-belle');?>  
      <?php addLink('http://mylink/YqfL5G', 698, 108, 16, 88, 'draped3', 'stray-dog');?>
      <?php addLink('http://mylink/Blah', 699, 434, 14, 84, 'draped3', 'shadow-catchers');?>                        
      <?php addLink('http://mylink/13kKqkq', 0, 575, 744, 575, 'draped3', 'mks-3');?>                                                           
      <img class="slide" src="img/issue-1/draped-in-nostalgia-03-small.jpg" style="display: none;" id="draped3" />
  </div>

So each addLink does another DIV (that is opened and closed with some details about it for tracking and popups at relevant locations).

Are you thinking my image-1... image-3 needs to have another empty div around them?

Starting to think I'll refactor or move onto another rotator option (perhaps fixing issues with my existing one). I appreciate your responses, but unfortunately the existing site is pretty deep with this existing functionality.

KevinBatdorf commented 11 years ago

Hey, I updated your code so that GitHub will use syntax highlighting.

Do you close out the slider at the end? In your code it seems you left off the closing div at the end. Was this just a mistake when copying it over?

I dont think you will need another div wrapped around, but it wouldnt hurt to try that.