$('#menuhome').click(function(){
$('#leftcolumncontainer').load('pages/homemenu.php');
});
the code above is used to load the home menu on the left side. Now, let's add the following:
$('#menuhome').click(function(){
$('#middlcolumncontainer').load('pages/homecontent.php');
});
this new code will load the home content in the center.
I want to achieve a functionality where clicking the button loads the home menu on the left and the home content in the center. However, the current code is not working as expected - both contents are loading in the center. I tried the following:
$('#menuhome').click(function(){
$('#leftcolumncontainer').load('pages/homemenu.php');
$('#middlcolumncontainer').load('pages/homecontent.php');
});
Even with this modification, the issue persists. How can I fix this?
"UPDATE"
$.when($('#leftcolumncontainer').load('pages/homemenu.php', $('#middlcolumncontainer').load('pages/imagegallerycolumn.php'))).done(function(x){
return(x);
});
This is the updated code currently being implemented.
Update
$('a.menuhome').click(function(e) {
$.when($('#leftcolumncontainer').load('pages/homemenu.php')).then(function() {
$.ajaxSetup({
url: "pages/homecontent.php",
success: function(result) {
$("#middlcolumncontainer").html(result);
}
});
$.ajax();
});});
The latest code works, but there is an issue with the middle container not loading the home content properly.
Home Content Page:
<div id="middlecontainerimagegallerycolumn" >
<div id="imagegallerycorner">
<div id="bigimage_container"></div>
<div id="bigimage_description"></div>
<div id="carousel_container">
<div id="left_scroll"><img src='images/left.png' /></div>
<div id="carousel_inner">
<ul id="carousel_ul" >
<li><a href='#'><img src='images/image1.jpg' id="1"/></a></li>
<li><a href='#'><img src='images/image2.jpg' id="2"/></a></li>
<li><a href='#'><img src='images/image3.png' id="3"/></a></li>
<li><a href='#'><img src='images/image4.jpg' id="4"/></a></li>
<li><a href='#'><img src='images/image5.jpg' id="5"/></a></li>
<li><a href='#'><img src='images/image6.png' id="5"/></a></li>
<li><a href='#'><img src='images/image7.png' id="5"/></a></li>
<li><a href='#'><img src='images/image8.png' id="5"/></a></li>
</ul>
</div>
<div id='right_scroll'><img src='images/right.png' /></div>
</div>
</div>
</div>
Javascript:
$("#bigimage_container").ready(function() {
document.getElementById("bigimage_container").style.background = 'url('+$('#carousel_ul li:first img').attr("src") +') ';
document.getElementById("bigimage_container").style.backgroundPosition = "center center";
document.getElementById("bigimage_container").style.backgroundRepeat = "no-repeat";
document.getElementById("bigimage_container").style.backgroundSize = "100% 100%";
document.getElementById("bigimage_description").innerHTML = $('#carousel_ul li:first img').attr("src");
});
$(document).ready(function() {
//move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
$('#carousel_ul li:first').before($('#carousel_ul li:last'));
//when user clicks the image for sliding right
$('#right_scroll img').click(function() {
document.getElementById("bigimage_container").style.background = 'url(' + $('#carousel_ul li:nth-child(3) img').attr("src") + ') ';
document.getElementById("bigimage_description").innerHTML = $('#carousel_ul li:nth-child(3) img').attr("src");
document.getElementById("bigimage_container").style.backgroundPosition = "center center";
document.getElementById("bigimage_container").style.backgroundRepeat = "no-repeat";
document.getElementById("bigimage_container").style.backgroundSize = "100% 100%";
var item_width = $('#carousel_ul li').outerWidth() + 10;
var left_indent = parseInt($('#carousel_ul').css('left')) - item_width;
$('#carousel_ul:not(:animated)').animate({
'left': left_indent
}, 100, function() {
$('#carousel_ul li:last').after($('#carousel_ul li:first'));
$('#carousel_ul').css({
'left': '-150px'
});
});
});
//when user clicks the image for sliding left
$('#left_scroll img').click(function() {
document.getElementById("bigimage_container").style.background = 'url(' + $('#carousel_ul li:first img').attr("src") + ') ';
document.getElementById("bigimage_description").innerHTML = $('#carousel_ul li:first img').attr("src");
document.getElementById("bigimage_container").style.backgroundPosition = "center center";
document.getElementById("bigimage_container").style.backgroundRepeat = "no-repeat";
document.getElementById("bigimage_container").style.backgroundSize = "100% 100%";
var item_width = $('#carousel_ul li').outerWidth() + 10;
var left_indent = parseInt($('#carousel_ul').css('left')) + item_width;
$('#carousel_ul:not(:animated)').animate({
'left': left_indent
}, 100, function() {
$('#carousel_ul li:first').before($('#carousel_ul li:last'));
$('#carousel_ul').css({
'left': '-150px'
});
});
});
});