[FIX] website_quote: scroll spy is crazy if the user change quote template. Must remove id created by the javascript of scroll spy.
This commit is contained in:
parent
2e5412fc1d
commit
009cc5278e
|
@ -65,24 +65,26 @@ $(document).ready(function () {
|
|||
});
|
||||
|
||||
// automatically generate a menu from h1 and h2 tag in content
|
||||
var ul = $('[data-id="quote_sidebar"]');
|
||||
var $container = $('body[data-target=".navspy"]');
|
||||
var ul = $('[data-id="quote_sidebar"]', $container);
|
||||
var sub_li = null;
|
||||
var sub_ul = null;
|
||||
$("section h1, section h2").each(function() {
|
||||
$("[id^=quote_header_], [id^=quote_]", $container).attr("id", "");
|
||||
$("h1, h2", $container).each(function() {
|
||||
switch (this.tagName.toLowerCase()) {
|
||||
case "h1":
|
||||
id = _.uniqueId('quote_header_')
|
||||
id = _.uniqueId('quote_header_');
|
||||
$(this.parentNode).attr('id',id);
|
||||
sub_li = $("<li>").html('<a href="#'+id+'">'+$(this).text()+'</a>').appendTo(ul);
|
||||
sub_ul = null;
|
||||
break;
|
||||
case "h2":
|
||||
id = _.uniqueId('quote_')
|
||||
id = _.uniqueId('quote_');
|
||||
if (sub_li) {
|
||||
if (!sub_ul) {
|
||||
sub_ul = $("<ul class='nav'>").appendTo(sub_li);
|
||||
}
|
||||
$(this.parentNode).attr('id',id)
|
||||
$(this.parentNode).attr('id',id);
|
||||
$("<li>").html('<a href="#'+id+'">'+$(this).text()+'</a>').appendTo(sub_ul);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
<link rel='stylesheet' href='/website_quote/static/src/css/website_quotation.css'/>
|
||||
<t t-raw="head or ''"/>
|
||||
</t>
|
||||
<body data-spy="scroll" data-target=".navspy">
|
||||
<body data-spy="scroll" data-target=".navspy" data-offset="50">
|
||||
<div class="container">
|
||||
<div class="row mt16">
|
||||
<div class="col-md-3">
|
||||
|
@ -462,7 +462,7 @@
|
|||
<link rel='stylesheet' href='/website_quote/static/src/css/website_quotation.css'/>
|
||||
<t t-raw="head or ''"/>
|
||||
</t>
|
||||
<body data-spy="scroll" data-target=".navspy">
|
||||
<body data-spy="scroll" data-target=".navspy" data-offset="50">
|
||||
<div class="container">
|
||||
<div class="row mt16">
|
||||
<div class="col-md-3">
|
||||
|
|
Loading…
Reference in New Issue