user3135177
user3135177

Reputation: 45

go to anchor (add at other funciotns)

this is my second post, sorry for my english, I write from Italy and I am not a devolper. I have this html code in masterpage.html:

jQuery:

<script type="text/javascript">
$(document).ready(function() {
    $('#content').load('divelencoarticoli.html');
});
</script>

include a list page (divelncoarticoli.html) in the follow div:

In the page divelncoarticoli.html I have this div:

<div class="one">
    <a class="art" href="part1.html">link 1</a>
    <a class="art" href="part2.html">link 2</a>
    <a class="art" href="part3.html">link 3</a> ecc. ecc 
</div>

This follow script (from stackflow) includes (and changes) on page for time part1.html, page2.html after the click and go to beginnig of the page included:

<script type="text/javascript">
$(document).ready(function() {
    // select all the links with class="art", when one of them is clicked, get its "href" value
    // load the content from that URL and place it into the tag with id="contentart"
    $('a.art').click(function() {
        var url = $(this).attr('href');
        $('#contentart').load(url);
        $('html,body').animate({scrollTop: parseInt($('#contentart').offset().top)}, 'slow');
        return false;
    });
});
</script>

at this div

<div style="width: 100%" id="contentart"></div>

I am not developer and I need another function: when my customer reads all the included page (part.1.html or part2.html ecc.ecc.) and he is at the bottom of these pages I would like include in the script a new function for close the included page (close the DIV and for GO TO TOP at the specific div called

<div class="one">

that is in masterpage.html, not in the included page.

Look: the link must be in every included pages: part1.html, part2.html ecc. ecc. and the target is top of the div class="one in the masterpage.html.

Is't possibile?

Thanks in advance.

Upvotes: 0

Views: 59

Answers (1)

robertp
robertp

Reputation: 3642

Your HTML syntax doesn't seem to be right:

<a> class="art" href="part2.html">link 2</a>
<a> class="art" href="part3.html">link 3</a>

Change it to:

<a class="art" href="part2.html">link 2</a>
<a class="art" href="part3.html">link 3</a>

Not sure if it's going to solve your problem but you never know :)

Upvotes: 1

Related Questions