Category: JavaScript
-
Calling APIs from Javascript/Node.js
This is one of the most common things nowadays developers are doing more than before. Raise of Microservices based architecture and distributed software development needs more inter-service communication i.e more codes for API consuming stuff, sometimes more than actual business logic. It is good that business logic coding is now less redundant. Consuming API with…
-
Make jQuery colorbox plugin responsive
Use jQuery colorbox lightbox plugin in responsive design with some native colorbox options jQuery(document).ready(function(){ jQuery(“.inline-sales”).colorbox({ inline:true, maxWidth: “90%”, onComplete : function() { jQuery(this).colorbox.resize(); } }); // resize colorbox on screen rotate in mobile devices and set to cover 90% of screen jQuery(window).resize(function() { jQuery.colorbox.resize({width:”90%”}); }); });
-
Scroll to top button without any additional jquery plugins
jQuery(‘#back-to-top’).bind(‘click’, function () { var item_top = jQuery(“body”).offset().top; jQuery(“body”).animate({scrollTop:item_top}, 1000); });