From JSHint.com:
Function declarations should not be kept in blocks. Use the function expression or take the statement to the top of the external function.
JSHint is asking me to take this function out of the success callback.
Function MatchChatHit () {var ContainerHit = $ ('# Project-Container') Outer heights (); $ ('# Project-wrapper.activated') CSS ('max height', containerhead); } SetTimeout (MacTontainer High, 100); $ (Window) .on ('resize', matchContainerHeight); However, I'm not sure how I can do this because the containerhigh
response comes from the response when the container height is received. But then, I'm not very normal with JS, so maybe there is a way. If so, please help me please .. Here's the full code:
function openProject () {var post_id = $ (this). .post-link for data ('id'), // data-id attribute ajaxURL = site.ajaxURL; // ajax URL works.php $ Ajax ({type: 'POST', url: ajaxURL, data: {'action': 'load-content', post_id: post_id} is localized with: function (response) {$ ('# project-container'). (Feedback) .images loaded (). Then (function () {resize (); // if the user is scrolled ... if ($ (window) .scrollTop ()! = = 0) {// top Scroll the page ('' html ' #products- Container '). External Heat (); $ (' # project-wrapper.activated '). CSS (' max-height ', containerhead);} SetTimeout (MacTontainerHight, 100); $ (window) .on (' resize ', MatchContainerHeight);}); // If the user has not scrolled ...} else {// Make a maximum-height of the container for a smooth transition function match. ContainerHit () {var ContainerHit = $ (' # ('Maximum height', ContainerHeight);} SetTimeout (MacTontainer Heights, 100); $ (window) .on ('Project-wrapper.activated'). Re Size ', matchContainerHeight); } return false; }); }}); }
This signal is saying that you move You can make it in a function expression such as:
var matchContainerHeight = function () {var containerHeight = $ (' # Project Container ') outerHeight () .; $ ('# Project-wrapper.activated') CSS ('max height', containerhead); } SetTimeout (MacTontainer High, 100); $ (Window) .on ('resize', matchContainerHeight); Although
In both cases, the same logic has been used, in this case, if both condition and position will be best to move it to the location within the blocks area , As suggested is JSHint. Try it:
// $ .ajax ({... success: work (feedback) {$ ('# project-container'). Html (response) .images loaded (). Then (function () {resize (); // if the user has scrolled ... if ($ (window) .scrollTop ()! == 0) {// Top page ('html, body') .mate ({scrollTop: 0}, 400, function () {// Make a maximum-height accurate of container for a smooth transition match ContainerHeight ()}) // if the user has not scrolled ...} Else { // Make the maximum height of the container to match a smooth transition O ContainerHeight ()} Return false;});} //}); Function match music () {var heighthandler = function () {var containerhite = $ ('# project-container'). Outer heights (); $ ('# Project-wrapper.activated') CSS ('max height', containerhead); } SetTimeout (height handler, 100); $ (Window) .on ('resize', height handler); }
No comments:
Post a Comment