Skip to content

Commit 3707a07

Browse files
committed
Add support for RTL languages
Adjusted css conditions to support RTL layouts for RTL languages like Arabic, Hebrew and Persian ... etc
1 parent c06327e commit 3707a07

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

js/jquery.validationEngine.js

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,13 +1690,26 @@
16901690
}
16911691

16921692
var pos = methods._calculatePosition(field, prompt, options);
1693-
prompt.css({
1694-
'position': positionType === 'inline' ? 'relative' : 'absolute',
1695-
"top": pos.callerTopPosition,
1696-
"left": pos.callerleftPosition,
1697-
"marginTop": pos.marginTopSize,
1698-
"opacity": 0
1699-
}).data("callerField", field);
1693+
// Support RTL layouts by @yasser_lotfy ( Yasser Lotfy )
1694+
if ($('body').hasClass('rtl')) {
1695+
prompt.css({
1696+
'position': positionType === 'inline' ? 'relative' : 'absolute',
1697+
"top": pos.callerTopPosition,
1698+
"left": "initial",
1699+
"right": pos.callerleftPosition,
1700+
"marginTop": pos.marginTopSize,
1701+
"opacity": 0
1702+
}).data("callerField", field);
1703+
} else {
1704+
prompt.css({
1705+
'position': positionType === 'inline' ? 'relative' : 'absolute',
1706+
"top": pos.callerTopPosition,
1707+
"left": pos.callerleftPosition,
1708+
"right": "initial",
1709+
"marginTop": pos.marginTopSize,
1710+
"opacity": 0
1711+
}).data("callerField", field);
1712+
}
17001713

17011714

17021715
if (options.autoHidePrompt) {
@@ -1742,10 +1755,20 @@
17421755
prompt.find(".formErrorContent").html(promptText);
17431756

17441757
var pos = methods._calculatePosition(field, prompt, options);
1745-
var css = {"top": pos.callerTopPosition,
1746-
"left": pos.callerleftPosition,
1747-
"marginTop": pos.marginTopSize,
1748-
"opacity": 0.87};
1758+
// Support RTL layouts by @yasser_lotfy ( Yasser Lotfy )
1759+
if ($('body').hasClass('rtl')) {
1760+
var css = {"top": pos.callerTopPosition,
1761+
"left": "initial",
1762+
"right": pos.callerleftPosition,
1763+
"marginTop": pos.marginTopSize,
1764+
"opacity": 0.87};
1765+
} else {
1766+
var css = {"top": pos.callerTopPosition,
1767+
"left": pos.callerleftPosition,
1768+
"right": "initial",
1769+
"marginTop": pos.marginTopSize,
1770+
"opacity": 0.87};
1771+
}
17491772

17501773
prompt.css({
17511774
"opacity": 0,

0 commit comments

Comments
 (0)