prevent next prev when youre add writting
This commit is contained in:
parent
910bd71c78
commit
b7bc4b8615
1 changed files with 4 additions and 4 deletions
|
|
@ -7,12 +7,12 @@
|
||||||
$(document).keydown(function(e){
|
$(document).keydown(function(e){
|
||||||
switch(e.keyCode) {
|
switch(e.keyCode) {
|
||||||
case 37:
|
case 37:
|
||||||
if(flag){//prevent redirect if textarea has focus
|
if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus
|
||||||
window.location.replace( "#{url_to_prev(@photo,@album)}" );
|
window.location.replace( "#{url_to_prev(@photo,@album)}" );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 39:
|
case 39:
|
||||||
if(flag){
|
if(!$("textarea").hasClass("hasfocus")){
|
||||||
window.location.replace( "#{url_to_next(@photo,@album)}" );
|
window.location.replace( "#{url_to_next(@photo,@album)}" );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
//asign a flag to determine if textarea has focus
|
//asign a flag to determine if textarea has focus
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("textarea").live('focus',function(){
|
$("textarea").live('focus',function(){
|
||||||
flag = 0;
|
$(this).addClass("hasfocus");
|
||||||
});
|
});
|
||||||
$("textarea").live('blur',function(){
|
$("textarea").live('blur',function(){
|
||||||
flag = 1;
|
$(this).removeClass("hasfocus");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue