-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In layout.html if i change the layout from the drop down then also keyboard always remains the same. #323
Comments
Hi @mithundebnath! I think the easiest solution would be to just load the desired layouts, since there are only two: <script src="layouts/bengali.js"></script>
<script src="layouts/hindi.js"></script> Then add the following code (demo): $(function () {
var layouts = [
'hindi',
'bengali-qwerty-1',
'bengali-qwerty-2'
],
addSelect = function (keyboard) {
var select = '<select class="layout">';
$.each(layouts, function(i,layout){
select += '<option value="' + layout + '">' + layout + '</option>';
});
$( select + '</select>' )
.appendTo( keyboard.$keyboard )
.val( keyboard.options.layout )
.change( function(){
keyboard.options.layout = $(this).val();
keyboard.reveal(true);
});
};
$('#keyboard').keyboard({
layout: 'hindi',
visible: function (e, keyboard, el) {
addSelect( keyboard );
}
})
// activate the typing extension
.addTyping({
showTyping: true,
delay: 50
});
}); I included this bit of css to position the select to the right side, but really it can be positioned anywhere you desire. If you want it at the top, then change .layout {
float: right;
} The only issue you might encounter is when swapping layouts, anything new typed into the keyboard will be lost. So maybe set In a future version, I plan to include a select within the layout where you can choose the layout as above. |
Hello Sir, |
The setup is very similar, but this time there is no need to use the Try this code (demo): HTML <script src="http://mottie.github.com/Keyboard/layouts/bengali.js"></script>
<script src="http://mottie.github.com/Keyboard/layouts/hindi.js"></script>
<select>
<option value="hindi">hindi</option>
<option value="bengali-qwerty-1">bengali-qwerty-1</option>
<option value="bengali-qwerty-2">bengali-qwerty-2</option>
</select>
<input class="keyboard" type="text" />
<textarea class="keyboard"></textarea> Script $(function () {
$('.keyboard').keyboard()
// activate the typing extension
.addTyping({
showTyping: true,
delay: 50
});
// make sure this is added after the keyboards are initialized
$('select').change(function () {
var layout = $(this).val();
$('.keyboard').each(function(){
var kb = $(this).data('keyboard');
kb.options.layout = layout;
// refresh keyboard if already visible
if (kb.$keyboard.length) {
kb.reveal(true);
}
});
}).change();
}); |
Hello Sir, |
Could you please post the changes you mentioned in a comment here? It would help ensure that I don't make any mistakes while making the correction. Also, if you have time, I would appreciate feedback on any of these layouts I've been working on:
Please feel free to use any of the above layouts. |
Hello Sir,
Sir I Know Assamese and it is also familiar to my mother tongue bengali. So I would love to learn more from your assamese inscript. Nepali and hindi alphabets are same.It is called Devanagari.Sir I dont know the alphabets of other mantioned languages. |
Oh, I also have "Devanagari - INSCRIPT" which I added above. Even though the Nepali and Hindi alphabets are the same, the layouts may be different. I generated the above keyboards from keyboard layouts provided by Microsoft. I also updated the above files to replace unicode with common characters like replacing |
Hello Sir, |
I've added all the above layouts into the Otherwise, I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue this discussion. |
Hello Sir, regards, |
In layout.html if i change the layout from the drop down then also keyboard always remains the same. I already have included the required js file in the head section.
I need two languages hindi and bengali. So i Have written like this
I have also included both .js files i.e. for hindi.js and bengali.js.
I can see the changes in "lang" dropdown So Its working till here. I can also see the change in
$('h2').text(title)
when i change in dropdown.But the keyboard doesnt change.i have noticed the code in layouts.html is like this
I always get "qwerty" layout. But If i change manually i.e. like this
Even i did try to do like this,
....function and tried to change the "layout: 'qwerty' " statement with
layout: $this.val()
andlayout: title
, In both the cases whatever in the first line of the dropdown is choosen by default,Then I change the dropdown it does not give any effect to the layout.What should i write so that i can change the the layout dynamically with the change in the dropdown???
The text was updated successfully, but these errors were encountered: