3

So, I have my main custom_js.js as shown below:

(function ($, root, undefined) {    
    $(function () {     
        'use strict';   
             //js goes here

        // Default line End
    }); 
})(jQuery, this);

Now, I have an external js file from blazy lazy load.

I tried to put the code in my custom_js.js as below (by just copying and pasting)

(function ($, root, undefined) {    
    $(function () {     
        'use strict';   
        //blazy v.1.5.1         
            (function(k,f){"function"===typeof.....
        // Default line End
    }); 
})(jQuery, this);

But I am getting an error (that "blazy" was not found).

I am simply trying to consolidate the external js into my custom_js file.

What am I doing wrong?

EDIT:

This is the setup:(Everything in footer)

Using the external js.

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

  <script type="text/javascript" src="https://raw.githubusercontent.com/dinbror/blazy/master/blazy.min.js"></script>

  <script type="text/javascript" src="http://example.com/js/custom_js.js"></script>
5
  • Can you post you html header where you embed these 2 JS? Commented Nov 18, 2015 at 20:38
  • I've just seen your EDIT. Why are you doing both including blazy.min.js AND copy & pasting it into your own custom_js.js? Just including blazy.min.js is enough. Commented Nov 18, 2015 at 20:45
  • I am trying to remove the external js and put into my own custom. The edit part is before consolidating. Anyway, I got it working =) Commented Nov 18, 2015 at 20:46
  • Where did you get error? On the line where you pasted blazy code in your custom_js.js or where you are trying to use blazy? Commented Nov 18, 2015 at 20:46
  • I moved the external code outside of my code in the custom_js.js (See the accepted answer). it works now =) Commented Nov 18, 2015 at 20:47

1 Answer 1

1

What about pasting it at the end of custom_js.js like that:

(function ($, root, undefined) {    
    $(function () {     
        'use strict';   
             //js goes here

        // Default line End
    }); 
})(jQuery, this);

//blazy v.1.5.1         
(function(k,f){"function"===typeof.....
Sign up to request clarification or add additional context in comments.

2 Comments

i will give that a try =)
Yup that did it. =) haha, simple solution always works the best! Thanks man

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.