Banner advertisements are take loading time and make your website slow from previous. In this post you able to get your solution. By following this post you can visible your ad with jquery. It's very simple fo and uses it increase your web page loading speed.
Make Loading Banner Advertisements With Jquery
Javascript CodeYou Just Contain javascript code. Using jquery ajax function. Let's see appear.
<script type="text/javascript" src="http://ajax.googleapis.com/topbanner.php (PHP&HTML)
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
content(); // 1 content block
topbanner(); // 2 top banner
sidebanner(); // 3 side banner
//Content Block
function content()
{
$.ajax({
type: "POST",
url: "content.php", //Content Page
data: "" ,
beforeSend: function()
{
$("div#content").html('<span class="loading">Loading...</span>');
},
cache: false,
success: function(data)
{
$("#content").html(data);
}
});
}
//Top Banner Block
function topbanner()
{
$.ajax({
type: "POST",
url: "topbanner.php", //Top banner File
data: "" ,
beforeSend: function()
{
$("div#topbanner").html('<span class="loading">Loading...</span>');
},
cache: false,
success: function(data)
{
$("#topbanner").html(data);
}
});
}
//Side banner funtion same like topbanner.
});
</script>
//HTML Code
<div id="main">
<div id="topbanner"></div>
<div id="content"></div>
<div id="sidebanner"></div>
</div>
<?phpCSS Code
echo '<a href=""><IMG src="topbanner.png" /></a>';
?>
#mainThese are the codes for making loading banner Ad. Hopefully, you enjoy this post and let me know have any question.
{
width:900px; border:solid 2px #dedede; margin-top:30px; height:600px
}
#topbanner
{
height:100px; border-bottom:solid 2px #dedede
}
#content
{
float:left;width:750px; height:498px
}
#sidebanner
{
float:left;width:148px; height:498px;border-left:solid 2px #dedede
}
.loading
{
color:#cc0000;
}