Skip to main content

Posts

Jquery Drag and Drop Issues

I am having a problem with bringing Jquery over to iPad. I made a drag and drop puzzle using Jquery, and on my computer it works fine. When I try to move that over to the iPad, the drag and drop functions cease to work. I have tried many a third party fix for this problem with no avail. Does anyone know how to solve this problem on iOS5? Or is there a better way to code it in HTML5 that works or a Jquery solution I do not know of? Any tutorials on the issue would be appreciated as well. Thanks.

Gathering segmented data via jQuery with FOR loops

Here's my code (what I'm stuck on is after the jump) <script language="JavaScript" type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script type="text/javascript"> var countThisMany = 4; //how many data-id's I want to count per "section" of images var finalString = ""; //blank var to be used later, must be defined here. </script> <img src="foo.jpg" data-id="id1" data-item="1" /> // just a bunch <img src="foo.jpg" data-id="id2" data-item="2" /> // of images with <img src="foo.jpg" data-id="id3" data-item="3" /> // data-* usage to <img src="foo.jpg" data-id="id4" data-item="4" /> // store two bits <img src="foo.jpg" data-id="id5" data-item="5" /> // of information &l

How to extract relative URL from argument values from request string?

I have a request url / string var like http://ip_or_url:4773/image_renderer.service?action=resize&from_format=png&from_url=http://ip_or_url:4773/my_file.user.file&to_format=jpg&w=1920&h=1200 It looks terribly scary. I wonder how to extract from_url=http://195.19.243.13:4773/my_file.user.file argument pair from it and then extract relative file url from that pair value my_file.user.file ?

get the true type prototype vs constructor?

I wanted to see the real type of [] . I always thought that i can use the apply method or the constructor . so i tried : [].constructor ->(showed me) function Array() { [native code] } and [].constructor.constructor ->(showed me) function Function() { [native code] } and Object.prototype.toString.apply([]) ->(showed me) "[object Array]" questions 1) Whom to believe ? 2)why line 2 is different ?

In javascript "If mobile phone"

I was thinking of doing something with the jQuery.browser but this only returns which browser you're in and if its a webkit etc etc. So i basically want to turn off certain js files from even loading if you're on a mobile device? I assume you can do it but how?

Exclude a certain number from this regex

I have this regex that test for an input with max length of 5. My problem is I want to exclude the single digit of 2. If string contains only number "2", it should fail. How do I exclude number 2 in this regex? /^([a-zA-Z,\d]){1,5}$/ 13425 - Match 03277 - Match 2 - Fail.

The best way to write Javascript / jQuery

I'm not new to web dev but I was just wondering if you guys have some advice for me to improve: Always when I write js or jQuery I write all the code like this in the <head> on my page: <script> $(document).ready(function() { //All my functions and animations goes here… }); </script> Now, when I look around the web I see that most people have their functions and animations in a separate ".js"-file. And they often create classes aswell. How does that work? What is the advantage of creating classes and have your functions in a separate file? Thanks, VG