I'm trying to implement the code from the first example here:
http://janpaepke.github.io/ScrollMagic/examples/advanced/parallax_scrolling.html
The following tween works (but tweens immediately)...
var tween = new TimelineMax().add([
TweenMax.to('#test',1,{top:"50%",ease:Linear.easeNone})
]);
When I add the following code...
var scene = new ScrollMagic.Scene({
triggerElement:'#test' ,
duration:500
})
.setTween(tween)
.addTo(controller);
I get the below error:
Uncaught TypeError: (intermediate value).setTween is not a function
I'm going crazy trying to figure this out. What am I doing wrong?
Answering my own question since god the documentation for this thing is sparse.
You need to include
http://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/plugins/animation.gsap.js
to make scrollmagic work with gsap
tips: make sure you added it after ScrollMagic.js script tag
Related
I'm working in a project with opencvjs and angularjs. I need to apply homography algorithm but when I create a Sift object, the console shows this error
TypeError: cv.Sift is not a constructor
Can somebody assist to tell me how can I resolve this problem?
You need to wait until OpenCV.js is compiled: cv['onRuntimeInitialized']=()=>{ doSomethingWithOpenCV() }
I am trying to learn React using JSBin. I have simple example code BookList and BookInfo (renders items inside BookList).
http://jsbin.com/hoyeroz/2/edit?js,output
I am getting below error in the console:
Uncaught TypeError: Cannot read property 'call' of undefined
Is this a JSBin bug or am I declaring the React components incorrectly?
Your code is proper, and working also, don't know why it is not working on JSBin, because same code is giving proper output on jsfiddle.
check fiddle: https://jsfiddle.net/03Lm3zbv/
Update: After doing some Google search finally got this:
This is a bug with JSBin, and how it handles transpilation with Babel. If you add the pragma //noprotect to the top of your code it will work.
check the working code on JSBin: http://jsbin.com/gedavinodu/edit?html,js,output
There is no explicit bind call here. So what's not bound? Well, if you put this in your compontentDidMount, you'll see that you get the result you are looking for.
this.setState({ books: [{"body": "body text", "name": "the name"}]});
So the ajax call is failing. This seems suspect: $.ajax. It seems to me that the $ is not bound to the jQuery function you think it is.
Here’s what I’m trying to do while testing an Angular app with Protractor. I would like to get a certain element, which is somewhat like this:
<div class="someClass">
<p>{{textFromBoundModel}}</p>
</div>
then get its html, and check whether it contains the text that I expect it to have.
I tried to get this element first by the cssContainingText method, but it didn't quite work (not sure why; maybe because the text within the paragraph is produced dynamically). So now I’m getting this element using just the by.css locator. Next, I'm checking whether it contains the text I’m testing for:
// this is Cucumber.js
this.Then(/^Doing my step"$/, function(callback){
var el = element(by.css('.someClass'));
expect(el).to.contain("some interesting string");
callback();
});
});
but this doesn't work. Problem is, el is some kind of a locator object, and I can’t figure out how to get html of the element it found in order to test against this html. Tried .getText(), with no success.
Any suggestions?
Does:
expect(el.getText()).to.eventually.contain("some interesting string");
work?
I believe you need the .eventually to wait for a promise to resolve, and you need the .getText() to get at the content of the div.
See the chai-as-promised stuff at the head of the cucumber sample.
Try the below solution worked for me
Solution 1 :
expect(page.getTitleText()).toContain('my app is running!');
Solution 2 :
expect<any>(page.getTitleText()).toEqual('my app is running!');
Seems to be a problem adding a component to a viewport in extjs due to some known issue
The ideal would be:
var paneltab = Ext.create('ROMLProjectAdmin.view.MainTabPanel');
Ext.getCmp('loginregister').destroy();
Ext.Viewport.add(paneltab);
An error occurs:
Uncaught TypeError: Object function constructor(){
// Opera has some problems returning from a constructor when Dragonfly isn't running. The || null seems to
// be sufficient to stop in misbehaving. Known to be required against 10.53, 11.51 and 11.61.
return this.constructor.apply(this, arguments) || null;
} has no method 'add'
Found this on the web which explains what's going on but I don't fully understand how to implement the proposed solution using 'refs' as I'm a newbie. I wondered if someone could give me a simpler explanation.
Or, based on the failing code above, can someone please give me an alternative way to launch a tab panel (in this case user logged in and so that screen is done with and now to open the main tabs).
Thanks in advance.
Kevin
Ext.Viewport is just the class, you need an instance of that class in order to add components to it:
Ext.create('Ext.container.Viewport', {
id: 'myviewport'
});
var paneltab = Ext.create('ROMLProjectAdmin.view.MainTabPanel');
Ext.getCmp('loginregister').destroy();
Ext.getCmp('myviewport').add(paneltab);
I've decided that I am going to try and learn backbone.js by making a web app. This is the first time I have done anything extensive in javascript, so the answer to my problem may be right in front of my face.
I have the web app on github, along with a running version that doesn't work. The javascript console just says that something is undefined when I don't think it should be. Here's the error that chrome gives for line 30 of app.js:
Uncaught TypeError: Cannot read property 'el' of undefined
I've sort of been referencing the backbone-fundamentals example modular to-do app, and it doesn't seem to have any issues with a similar thing.
If anyone could point out what I am doing wrong, I would be most appreciative!
Thanks in advance!
Your Machine view render method was missing return this and by default all methods return undefined - that's why chaining didn't work
Edit: and a small tip:
jQuery, Underscore and Backbone register globally - and thanks to that you don't have to define them as dependencies every time - it's enough if you require them in your main script once and after that you can access them from the global scope as you normally would
In my case i was returning this without the return keyword. As i was using javascript and not coffeescript it failed on me. So, if you are using javascript use return this; instead of just this in the last line of the render() function.
I also had a problem when using this.collection.on('reset', this.render(), this). I instead had to use this.collection.on('reset', this.render.bind(this));