ryanve / response.js

Responsive design toolkit
http://responsejs.com
Other
801 stars 123 forks source link

How to call function after content changes? #35

Open nodogod opened 10 years ago

nodogod commented 10 years ago

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 commented 10 years ago

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

ryanve commented 10 years ago