javascript detect ios7 ipad - javascript

following the code from this question, I'm trying to add a class to html for handling iPad landscape layout issues.
But the JS to detect iPad iOS7 doesn't seem to work anymore:
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('html').addClass('ipad ios7');
}
I tried it on an iPad4 iOS7.
Can anyone confirm that the detection code is working for them?
EDIT: thanks to Waki's test page, we can be sure it is working.
And going through my 800 lines of app code again thoroughly, I found that I called my function that includes the code for the check from within document.ready but the function itself was placed outside of document.ready and therefore was not called. Really stupid mistake. I apologize to all who wasted their time on reading this.

are included jQuery library for use $('html') ? Because this regex is working.

Related

JQuery carousel and template doesn't work together

First of all, I'm sorry if this is already asked. I couldn't find a answer.
I have a HTML5 template bought at themeforest and a jQuery carousel. I am not very similar with JavaScript or JQuery.
When I wanted to implement the carousel like it said in the description the JQuery/Javascript didn't work.
I found out that it could be the version of JQuery. The template(cleanstart) uses version 1.11.2 and the carousel uses 1.44.4. When I changed the carousel to that version it didn't work. When I changed the template version to 1.44.4, it didn't work either.
Then I've put the text from the carousel.js in a script tag in the HTML, and that seemed to work but then the templates jQuery didn't work...
Do you have any idea what the problem can be? Maybe a variable with the same name? I really don't know how to solve it.
Help is much appreciated!
With just this Information, It's pretty hard to help you. It could be a problem with your Implementation, a compatibility Issue or many things else.
Do you have a public page where the template and the carousel are implemented? Does the console window give you any error (if you don't have it yet, I recomend you to get Firefox and the addons Firebug and Webdeveloper Toolbar).
I have found my problem. it was a scroll section that causes the other jquery to stop. When I removed that part of the code, nothing bad with the carousel happened and the other parts worked fine!

Open link in popup window

I might be tired but I just can't figure out what the problem is. What I'm trying to do is open a link in a popup window. I got this code below working before but I removed it.
About
However, it stopped working now when I put it back. I even got it working on jsFiddle so I'm at lost on what to do. I'm assuming something must be blocking it from running?
The code is short and simple so I figured someone here might have an idea what could cause this.
EDIT: Sorry I should have thought of it. I guess I should sleep. Anyway here's a demo-website where I reproduced the problem http://testmycode.tumblr.com/ The problem is the "About" link, pressing it returns nothing.
OK, it seems like somewhere in your code you have changed the window variable to a custom function. When you try to call window.open (more specifically, document.window.open), the method open simply doesn't exist in the function window, which causes it to throw an error.
Check this out:
You somewhere changed it to a function by doing document.window = ....
It's MooTools 1.2.4 which changed it:
To fix it, simply using an EventListener and problem solved! (Inline codes are bad practice anyway.)
<a class="about">About</a>
$(".about")attr("href", "#").click(function(e){
window.open(...);
e.preventDefault();
});
The snippet you shared works when I append it to the page we are at, in Google Chrome. Which makes me wonder which browser you are having the trouble in. So I would encourage you to try the snippet you shared in Google Chrome, and if it works there then you will know it is a browser specific kind of bug, in which case I would try adding a semicolon after return false.

Set cursor to end of textarea- setSelectionRange() broken on Firefox?

My initial question is a direct dupe of this question, trying to put the cursor at the end of a textarea.
one
two
three|<-- ideal position
It worked fine on all browsers except Firefox (I'm currently using version 18.0). Even the jsfiddle that Tim provided in the link above (for convenience: http://jsfiddle.net/DqtVK/40/) is not working.
It seems it's not highlighting or placing the cursor at all anymore.
I understand jquery is an alternative option (as found here) but did something happen on firefox's side that makes this method no longer reliable? Anyone have any insight? Is there a way to avoid the jquery route?
Thanks!
Looks like there was an uncaught exception that was preventing my piece of code from finishing. It seems firefox really doesn't like focusing on a hidden piece of HTML. Lesson learned, make sure your target is visible!
Though why the jsfiddle is not working properly is still a mystery to me...
but my base issue has been solved.
If anyone can explain the jsfiddle mystery, please keep respondin' I'll be on the lookout.

Jquery Slider Rotates but something strange happens

I have a little problem, I've been working on this slider based on http://www.zurb.com/playground/orbit-jquery-image-slider (Orbit Slider) and Carousel plugins. You can view the results on my test page http://www.unscspartanteamomega.com/localh0st# . As you can see the images are rotating, but this only works on Firefox for some odd reason. In Chrome the images rotate behind the background and I don't know why, also the caption are not rotating either. Has this happened to anyone before? If anyone knows a possible solution to this, please let me know.
Here's the code I used to call the plugin
$(window).load(function() {
$('#carousel').orbit();
});
Thank you!
Okay here is my suggestion for you. Check these js files on your page.
cameramod
jquery.easing.1.3
jquery.min
jquery.mobile.customized.min
they have some errors like unexpected tokens ('<') and your main html file's script also contain an error #object has no method. Try to correct these first. Not very major errors just spend some time on them, monitor them carefully using web developer tools. Happy coding :)

div onclick not firing in IE 8 and Chrome

I have the following javascript function in my application which is expected to perform grid filtering based on the div click, but the major problem i am facing is that the div click is working fine in mozilla firefox , but not in IE 8 and chrome, can anyone help to figure the issue related to this function
$(function(){
$('#FileDiv').live('click', function (e) {
alert(1);
});
});
Need the HTML to verify, but here's where I've run into trouble with this:
Make sure a div with id="FileDiv" is actually there. I see you're using ASP.NET and I have spent time debugging client-side code affecting content that was not delivered becuase of server-side logic. Real forehead-smacking stuff.
Try other events. Instead of live, try straight-click to see if that matters.
Make sure your function is being called on document-load. I suspect it isn't.

Categories