Screen orientation ios

Check some JQM API here…( haven’t test yet ) http://api.jquerymobile.com/orientationchange/ Orientationchange Timing The timing of the orientationchange event with relation to the change of the client height and width is different between browsers, though the current implementation will give you the correct value for event.orientation derived from window.orientation. This means that if your bindings are … Read more

JQuery Ajax Request: Change User-Agent

It is simply impossible, you are not allowed to change the user-agent for XMLHttpRequests. I’m not sure if this is valid for Internet-Explorer, but the w3c specifies here: The setRequestHeader() method […] When the setRequestHeader(header, value) method is invoked, the user agent must run these steps: […] Terminate these steps if header is a case-insensitive … Read more

How to send image to PHP file using Ajax?

Use JavaScript’s formData API and set contentType and processData to false $(“form[name=”uploader”]”).on(“submit”, function(ev) { ev.preventDefault(); // Prevent browser default submit. var formData = new FormData(this); $.ajax({ url: “page.php”, type: “POST”, data: formData, success: function (msg) { alert(msg) }, cache: false, contentType: false, processData: false }); });

Can I load external stylesheets on request?

Yup: if you create a <link> tag linking to a stylesheet and add it to the <head> tag, the browser will load that stylesheet. E.g. $(‘head’).append(‘<link rel=”stylesheet” type=”text/css” href=”https://stackoverflow.com/questions/2126238/lightbox_stylesheet.css”>’); However, as per @peteorpeter’s comments, this doesn’t work in IE 8 or under — there, you need to either: append the <link> before setting its href; … Read more

.live() vs .bind() [duplicate]

The main difference is that live will work also for the elements that will be created after the page has been loaded (i.e. by your javascript code), while bind will only bind event handlers for currently existing items. // BIND example $(‘div’).bind(‘mouseover’, doSomething); // this new div WILL NOT HAVE mouseover event handler registered $(‘<div/>’).appendTo(‘div:last’); … Read more

Problems with Google Maps API v3 + jQuery UI Tabs

Note: this answer received an invalid 3rd party edit which essentially replaced its content, something that a 3rd party editor should not do. However, the result may be more useful than the original, so both versions are now given below: Original author Anon’s version from 2010, after one edit by Anon google.maps.event.trigger(map, ‘resize’); map.setZoom( map.getZoom() … Read more

Fade in each element – one after another

Let’s say you have an array of span elements: $(“span”).each(function(index) { $(this).delay(400*index).fadeIn(300); }); (quick note: I think you need jQuery 1.4 or higher to use the .delay method) This would basically wait a set amount of time and fade each element in. This works because you’re multiplying the time to wait by the index of … Read more