loopj / jquery-simple-slider

Unobtrusive numerical slider plugin for jQuery
194 stars 113 forks source link

methods not working #8

Closed thepixelmonk closed 11 years ago

thepixelmonk commented 11 years ago

when running data.el.simpleSlider('setRatio', 1) inside the ready callback, I get: Uncaught TypeError: Cannot read property 'setRatio' of undefined

thepixelmonk commented 11 years ago

I think obj is being set to undefined here: obj = $(this).data("slider-object") (line 308)

thepixelmonk commented 11 years ago

Yeah something's going wonky with this: $(this).data "slider-object", new SimpleSlider($(this), settings)

gregavola commented 11 years ago

Are you using Jquery or zepto? If zepto - make sure you include data.js

Greg

Sent from my iPhone

On Jan 26, 2013, at 3:49 AM, Chris Bolton notifications@github.com wrote:

Yeah something's going wonky with this: $(this).data "slider-object", new SimpleSlider($(this), settings)

— Reply to this email directly or view it on GitHub.

thepixelmonk commented 11 years ago

Using jQuery, and .data seems to be working in general. If I insert $(this).data 'foo', 'bar' above that line it saves that info.. just doesn't save new SimpleSlider

danieelito commented 11 years ago

Is happend to me, i tod i was including wrong the function:

$("#my-input").simpleSlider("setValue", 50);

But then i found this, maybe it could be the same problem.

Any suggestions?

davidjohnfarmer commented 11 years ago

Same issue here =(

davidjohnfarmer commented 11 years ago

..using jquery

davidjohnfarmer commented 11 years ago

Dom was not fully loaded - jQuery(document).ready(function($)... etc fixed it

pratikabu commented 5 years ago

I was facing this issue and I did as below.

I replaced document.addEventListener('DOMContentLoaded', function () {}) with $( document ).ready(function() {}) and it started working fine.

Thanks for the clue.