Function_loadCSS = function(href) { var cssLink = $(“<link>”); $(“head”).append(cssLink); //IE hack: append before setting href cssLink.attr({ rel: “stylesheet”, type: “text/css”, href: href }); };
Chuyên mục: Uncategorized
Loading multiple javascript files bằng jquery
$.when( $.getScript( “/mypath/myscript1.js” ), $.getScript( “/mypath/myscript2.js” ), $.getScript( “/mypath/myscript3.js” ), $.Deferred(function( deferred ){ $( deferred.resolve ); }) ).done(function(){ //Khi load xong các file js });
Check sự kiện click hoặc move element bằng jquery
var isMove = false; $(element ) .mousedown(function() { isMove= false; }) .mousemove(function() { isMove = true; }) .mouseup(function() { if(isMove){ alert(‘click element’); }else{ alert(‘di chuyen element’); } });
di chuyển và phóng to thu nhỏ element bằng jquery
1. Di chuyển $(“element”).draggable({ }); https://jqueryui.com/draggable/ 2. Phóng to thu nhỏ $(“element”).resizable({ }); https://jqueryui.com/resizable/