我有一个布局,比如:
<header class="header">
<div class="logo">Logo Here</div>
<nav class="menu">Menu Here</nav>
</header>
<div class="container">
<aside class="aside">
<!-- Here are the Buttons that Filters the Content in .main-content class -->
</aside>
<div class="main-content">
<!-- The list of contents here are shown according to the filter in sidebar -->
<!-- The contents are lets say only tables and Ajax button does its filter -->
<div class="export-link">Export Link</div> <!-- This export list is created by Ajax and for every filter value the link changes -->
</div>
</div>
<footer class="footer">
<div class="some-links">Some Links</div>
</footer>
我想把那个div.export-link
放在nav.menu
里。
一开始我做了一些类似的事情
if($('.new__nav-class').length === 0 ){
$('.menu, .export-link').wrapAll('<div class="new__nav-class"> </div>');
}
这会将div.export-link
和nav.menu
放在标题部分的新div.new__nav-class
中,我可以应用CSS使其更美观。
然而,问题是它不再接受筛选器值。.export-link
内部的link
通常会随着过滤器的变化而变化,比如href="/page?Thisfilter-Thatfilter"
,但自从我将包装器放在.export-link
顶部并将其放在菜单中后,这个链接就变成了静态的。
有什么解决方案吗?怎么解决这个问题?
发布于 2013-10-31 02:36:14
检查你的DocType
尝试使用<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
或<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
发布于 2013-11-01 01:57:31
位置:如果你只需要将字段移动到页面上的其他地方,绝对可以很好地为你工作。只需将它的父位置设置为: relative,它在所有浏览器上看起来都应该没问题。(当然,您会想要检查。)
发布于 2013-11-04 02:27:33
我认为您可以使用ajaxStop事件来查看链接是否已更改,并将其复制到您想要的新div中。ajaxStop是每当ajax响应返回到页面时发生的事件。下面的javascript说等待ajax响应。当响应发生时,获取#old-div中的html并将其放入#new-div中:
<html>
<head></head>
<body>
<header>
<div id="new-div"></div>
</header>
<div class="other-container">
<div id="old-div">link stays updated here</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$(document).ajaxStop(function() {
var link = $('#old-div').html();
$('#new-div').html( link );
});
});
</script>
</body>
</html>
https://stackoverflow.com/questions/19691068
复制相似问题