mkhairi / materialize-sass

Materializecss rubygem for Rails Asset Pipeline / Sprockets
http://materialize.labs.my/
MIT License
805 stars 243 forks source link

.tabs() Uncaught TypeError: Cannot read property 'left' of undefined #138

Closed thalesmiguel closed 7 years ago

thalesmiguel commented 7 years ago

Hello. I've just updated this awesome gem on my project and I'm getting an error when initializing my tabs. When using $(ul.tabs).tabs(); I get a Uncaught TypeError: Cannot read property 'left' of undefined.

Anyone else getting this message?

Thanks in advance.

aeroreyna commented 7 years ago

Happen to me too. Is there a solution?

mkhairi commented 7 years ago

try update gem with latest release

aeroreyna commented 7 years ago

In my case, I was using div instead of li for each item, inside the ul. Using li solves the problem for me.

qantumthemes commented 6 years ago

the js shoudln't throw errors because of the html. To fix the tabs.js you have to add a control in tabs.js line 42 and 49 if(undefined === el.position()) {return;}

 var calcRightPos = function(el) {
        if(undefined === el.position())  {return;}
        return Math.ceil($tabs_width - el.position().left - el.outerWidth() - $this.scrollLeft());
      };

 var calcLeftPos = function(el) {
        if(undefined === el.position())  {return;}
        return Math.floor(el.position().left + $this.scrollLeft());
      };
woohyodong commented 3 years ago

Change ul -> ol