user3841611
user3841611

Reputation: 91

How to do page load in jQuery?

I have this menu in HTML / CSS:

HTML:

<div id="outer">
        <div id="inner"><a href="kingkong.html">King Kong</a></div>
        <div id="inner"><a href="table.html">Table</a></div>

CSS:

#inner {
    background-color: #547980;
    width: 130px;
    margin-left: 8px;
}
#inner:first-child {
    background-color: #547980;
    width: 130px;
    margin-left: 8px;
    margin-top: 8px;
}            
div {
    border-radius: 5px;
    border: 2px solid black;
}

and I want load page in jQuery.

  1. It can be like printer, after click on link from menu it should start from margin-left position 140 and printing to margin-right position 20 or
  2. Loading like book when you go to another page.

But I don't know how to do it. Any advice please?

Upvotes: 0

Views: 76

Answers (1)

roNn23
roNn23

Reputation: 1662

With jQuery you can use this script:

$('body').on('click', 'a', function(event) {
  event.preventDefault();
  var href = $(this).attr('href');
  $('.result').load(href);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="kingkong.html">Menu Link</a>
<div class="result"></div>

Upvotes: 0

Related Questions