Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call function after content changes? #35

Open
nodogod opened this issue Aug 19, 2013 · 2 comments
Open

How to call function after content changes? #35

nodogod opened this issue Aug 19, 2013 · 2 comments

Comments

@nodogod
Copy link

nodogod commented Aug 19, 2013

Sorry for my English. For example:

<div id="test" data-min-width-960="Width 960+">
    Content Fallback
</div>

If I load this on large desktop and try to get the content in the div via jQuery, it returns "Content Fallback", not "Width 960+". I also on ready, resize, and action.

Response.ready(function(){
    // it will return "Content Fallback"
    console.log($('#test').html());
});

Response.resize(function(){
    // It will return that content that being changed, it's exactly what I need, 
    // but it can't return content when first load and not resize
    console.log($('#test').html());
});

Response.action(function(){
    // it will return "Content Fallback" on first time load, 
    // and return the content that being changed.
    console.log($('#test').html());
});

So, I think in fact my problem is how to get the correct content when the page loads the first time. Thank you, sorry for my bad English again, hope you can understand what I mean.

@ryanve
Copy link
Owner

ryanve commented Aug 30, 2013

Are there errors in the console? What is your Response.create() (or [data-responsejs]) configuration? It sounds like an issue with the configuration.

@ryanve
Copy link
Owner

ryanve commented Jan 25, 2014

  • To run code after the initial change, run it either or after your Response.create() setup or if using only [data-responsejs] to setup then immediately after the response.js file runs.
  • To run code after subsequent changes, use Response.resize(fn)

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

No branches or pull requests

2 participants