I am using a keynav plugin that allows me to navigate up and down though a list.
我正在使用keynav插件,允许我通过列表上下导航。
This list is dynamically generated using ajax and mysql. the suggesstions appear when someone begins to search into an input box.
此列表是使用ajax和mysql动态生成的。当有人开始搜索输入框时会出现suggesstions。
if the user clicks off and the list closes and then begins a new search, when the list is generated the second time, the keyboard navigation breaks. I dont want the page to refresh but is there anyway to "refresh", "reload" the keyvav.js or possibly the function iteself after the user closes the list? so the file loads and hopefully works correctly when the user tries to search again.
如果用户单击关闭并且列表关闭然后开始新搜索,则第二次生成列表时,键盘导航会中断。我不希望页面刷新,但无论如何在用户关闭列表后“刷新”,“重新加载”keyvav.js或者可能是函数iteself?所以文件加载,并希望在用户再次尝试搜索时正常工作。
$('body').click(function() {
$('#suggestions').fadeOut();
.....do magic "refresh" .....
});
1 个解决方案
#1
0
Well if it is set up by the a init() function couldnt you just rerun that, but if you really want to reload the whole script you could get the file content with a ajax request then eval() it. not the best way because eval is murder on computers because it reboots the javascript encoder but it will do what you need
好吧,如果它是由init()函数设置的,你就不能重新运行它,但如果你真的想重新加载整个脚本,你可以用ajax请求获得文件内容,然后eval()它。不是最好的方法,因为eval是计算机上的谋杀,因为它重新启动了javascript编码器,但它会做你需要的
#1
0
Well if it is set up by the a init() function couldnt you just rerun that, but if you really want to reload the whole script you could get the file content with a ajax request then eval() it. not the best way because eval is murder on computers because it reboots the javascript encoder but it will do what you need
好吧,如果它是由init()函数设置的,你就不能重新运行它,但如果你真的想重新加载整个脚本,你可以用ajax请求获得文件内容,然后eval()它。不是最好的方法,因为eval是计算机上的谋杀,因为它重新启动了javascript编码器,但它会做你需要的