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

Added onRespondComplete callback. #289

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ Sure, a couple:
- respond.update() : rerun the parser (helpful if you added a stylesheet to the page and it needs to be translated)
- respond.mediaQueriesSupported: set to true if the browser natively supports media queries.
- respond.getEmValue() : returns the pixel value of one em

- respond.onRespondComplete : will be called after respond finishes it's job.
Example:
<pre>
window.respond.onRespondComplete = function(){
//make body visible after css is parsed, in order to prevent flickering
document.body.style.visibility = 'visible';
};
window.respond.update();
</pre>

Alternatives to this script
======
Expand Down
4 changes: 2 additions & 2 deletions dest/respond.matchmedia.addListener.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions dest/respond.matchmedia.addListener.src.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*! Respond.js v1.4.2: min/max-width media query polyfill
* Copyright 2014 Scott Jehl
* Copyright 2015 Scott Jehl
* Licensed under MIT
* http://j.mp/respondjs */

Expand Down Expand Up @@ -242,14 +242,17 @@
}, makeRequests = function() {
if (requestQueue.length) {
var thisRequest = requestQueue.shift();
ajax(thisRequest.href, function(styles) {
return ajax(thisRequest.href, function(styles) {
translate(styles, thisRequest.href, thisRequest.media);
parsedSheets[thisRequest.href] = true;
w.setTimeout(function() {
makeRequests();
}, 0);
});
}
if (typeof respond.onRespondComplete === "function") {
respond.onRespondComplete.call(w);
}
}, ripCSS = function() {
for (var i = 0; i < links.length; i++) {
var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
Expand Down
Loading