简体   繁体   English

VelocityTemplate:如何避免在使用#parse()时重新加载导航栏

[英]VelocityTemplate : How to avoid re-loading of navigation bar while using #parse()

I have good knowledge of java but 0 knowledge of Velocity. 我对Java有很好的了解,但对Velocity有0的了解。 I have a task in which I have to stop collapsing of dropdown options of navigation bar. 我有一个任务,必须停止折叠导航栏的下拉选项。 First I thought its a twitter bootstrap issue (collapsing dropdown) but then i realize that every dropdown-option on which I am clicking, is loading the entire page including the navigation bar and that's why dropdown is closing every time . 首先,我认为这是一个Twitter引导问题(崩溃的下拉菜单),但随后我意识到,我单击的每个下拉菜单选项都会加载整个页面,包括导航栏,这就是下拉菜单每次关闭的原因。

So lets say I have a page sample.html having #parse("common.vm.html") inside it and page common.vm.html having #parse("header.vm.html") inside it; 假设我有一个页面sample.html ,里面有#parse(“ common.vm.html”) ,而页面common.vm.html里面有#parse(“ header.vm.html”) header.vm.html is the page where I have my navigation bar implementation. header.vm.html是实现导航栏的页面。

You must realize that Velocity evaluates on the server side, so can only happen on a page reload. 您必须意识到Velocity在服务器端进行评估,因此只能在页面重新加载时发生。

If you only want to reload a part of the page, use ajax calls from the javascript side. 如果您只想重新加载页面的一部分 ,请使用JavaScript端的ajax调用。

For instance, using jquery: 例如,使用jquery:

$('.dropdown_option').click(function()
{
    $('#dynamic_content').load('/path/to/dynamic/part.vm.html');
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM