Improving scroll
Testing the draft code for improve the center rigth position, i see some cosmetic issues related to promp position and the scrolling:
- scroll top: i've found fails in the overflown div's when the window isn't maximized. Sometimes the promt showed isn't the first : though the scroll for an overflown div works ok, the first prompt would be hidden because the lack of compensation with the window's scroll.
- scroll left: as the top case, with the difference that is the same for overflown or not div's. Sometimes, the window's scroll, hidde partial o totally the prompt.
So, in order to fix both issues i suggest you the next : [.......]
if (options.scroll) {
// get the position of the first error, there should be at least one, no need to check this
//var destination = form.find(".formError:not('.greenPopup'):first").offset().top;
// look for the visually top prompt
var destination = Number.MAX_VALUE;
var fixleft = 0; // -----------> NEW
var lst = $(".formError:not('.greenPopup')");
for (var i = 0; i < lst.length; i++) {
var d = $(lst[i]).offset().top;
if (d < destination) {
destination = d;
fixleft = $(lst[i]).offset().left; // -----------> NEW
}
}
if (!options.isOverflown)
$("html:not(:animated),body:not(:animated)").animate({
scrollTop: destination,
scrollLeft: fixleft //-----------> NEW
}, 1100);
else {
var overflowDIV = $(options.overflownDIV);
var scrollContainerScroll = overflowDIV.scrollTop();
var scrollContainerPos = -parseInt(overflowDIV.offset().top);
destination += scrollContainerScroll + scrollContainerPos - 5;
var scrollContainer = $(options.overflownDIV + ":not(:animated)");
scrollContainer.animate({
scrollTop: destination
}, 1100);
// ------------ NEW ------------>
$("html:not(:animated),body:not(:animated)").animate({
scrollTop: overflowDIV.offset().top,
scrollLeft: fixleft
}, 1100);
// <----------- NEW ----------------
}
}
return false;
}
[........]
Then, this changes will keeps visible the prompt don't matter its position or the size of the windows. I've tested it on FF4 and IE8.
Alejandro
That looks good. I have yet to test it.
lamuzzachiodi may I ask you a favor ? Could you please post your changes using a PULL REQUEST. Git is really easy to use and it saves us precious time. Please fork the repository, clone your copy, apply your changes, push to github and submit a pull request.
Plus you will get credit for it, as git remembers the author or the change.
Thank you for your contribution
I've just posted contribution directions in the README, search for contribution
https://github.com/posabsolute/jQuery-Validation-Engine/blob/master/README.md
Ok. I will do it. I must expect your test ?.
"I must expect your test?" -> what does this mean ?
I mean, it's best if i wait for make the post until you test the code just in case would be necessary made a fix, for example; or i haven't wait for, i post the code and later you test?
lamuzzachiodi, you don't get my point: I don't have time.
It's time consuming to look at your code above and figue which lines you changed. it's much easier to get the change from your fork - it takes one click.
Since you are the author of that fix, I would also expect a sample html that demonstrates the change. like a unit test or a new demoXXXX.html file.
thank you
i'll try follow the guide for use git but i have a problem (see below). My question is: if take me some time find the solution to this, my copy of the repository is ever updated or i must do something (for update it) before to continue whit the steps after the cloning?.
------------------------------------ The error -----------------------------------------------------
C:\Archivos de programa\Git\bin>git clone [email protected]:lamuzzachiodi/jQuery-Va lidation-Engine.git my-jqv-repo Cloning into my-jqv-repo... The authenticity of host 'github.com (207.97.227.239)' can't be established. RSA key fingerprint is (...key...) Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of know n hosts. Permission denied (publickey). fatal: The remote end hung up unexpectedly
hum that's an interesting issue. try to clone using the https link
looks like your key is not setup properly. -> you need to generate a key or use an existing one
cd ~/.ssh
cat id*.pub
copy the text into your github profile - there is a section to register your ssh keys.
May be git is really to use on Linux ... Windows is another story !. Finally i've generated the keys and after guess the bash's way, i've followed the instructions. However, when i check my new branch on my repository i don't see any change (i modified one file). What i did wrong?. This is the command's sequence :
Welcome to Git (version 1.7.4-preview20110204) Run 'git help git' to display the help index. Run 'git help' to display help for specific commands. Alejandro@midisco ~ $ cd my-jqv-repo sh.exe": cd: my-jqv-repo: No such file or directory Alejandro@midisco ~ $ cd ~/.ssh Alejandro@midisco ~/.ssh $ cd my-jqv-repo Alejandro@midisco ~/.ssh/my-jqv-repo (master) $ git branch myscrolling-patch Alejandro@midisco ~/.ssh/my-jqv-repo (master) $ git checkout myscrolling-patch Switched to branch 'myscrolling-patch' Alejandro@midisco ~/.ssh/my-jqv-repo (myscrolling-patch) $ git commit -m "Improving the scroll (including overflown div's)" # On branch myscrolling-patch # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: js/jquery.validationEngine.js # no changes added to commit (use "git add" and/or "git commit -a") Alejandro@midisco ~/.ssh/my-jqv-repo (myscrolling-patch) $ git push Everything up-to-date Alejandro@midisco ~/.ssh/my-jqv-repo (myscrolling-patch) $ git push origin myscrolling-patch Total 0 (delta 0), reused 0 (delta 0) To [email protected]:lamuzzachiodi/jQuery-Validation-Engine.git * [new branch] myscrolling-patch -> myscrolling-patch
(Ooops!. I've closed this by accident. Sorry, i'm very tired.)
ok, git works differently than CVS. you have to prepare the files to commit before you actually commit them. this is called the staging area.
from ~/.ssh/my-jqv-repo do
git add .
git commit -m "Improving the scroll (including overflown div's)"
git push
if git push doesn't work -> git push origin master
EUREKA!. I can do it !. These last commands works fine. Your README was very useful (don't forget add it the "git add ."),i suggest you include this for the Window's users: http://help.github.com/win-set-up-git/ It's a very clear guide for git's beginners.
Congrats. Will enhance the documentation when I can find some time. Don't forget to switch back to another branch once you pull request is complete. git checkout master
or any new commit to the patch branch will be bundled with the merge request
will look at you pull request shortly
closing, as this has been merged. thank you
Hello All, I have problem with scrolling while displaying error message in mobile devices, the page should scroll up to 1st error message in my page this functionality is working fine in web browsers(PC) but same is not working properly in mobile browser scroll position is pointing some other place. Am using jquery validation engine to validate my form (VER:Validation Engine 2.2, jQuery plugin) and jquery mobile to create the form.
Thanks in advance