Hi All,
It's hard to get a code sample running as this is a Wordpress site on my localhost. Anyway I shall try to explain and if anyone can send me off in the right direction great.
Basically when you click a div a box slides down and calls in the wordpress post information relating to the div id clicked.
This all works but once I am inside the slidedown i want some more click events.
This is the function which works well outside of the AJAX call but not inside the slidedown box where I need it working. It simply swaps the image in a div with the image contained within the data-href link.
$(function () {
$(".subnav a").click(function (e) {
var url = $(this).data('href')
$('#imageBox img').prop('src', url)
return false;
});
});
This is how I have the AJAX working to call in post data:-
$.ajaxSetup({cache:false});
var post_link = $(this).attr("rel");
$("#panel").empty().html("loading...");
$("#panel").load(post_link);
//return false;
var height = $("#panel").height();
if( height > 0 ) {
$('#panel').css('height','0');
} else {
var clone = $('#panel').clone()
.css({'position':'absolute','visibility':'hidden','height':'624px'})
.addClass('slideClone')
.appendTo('body');
var newHeight = $(".slideClone").height();
$(".slideClone").remove();
$('#panel').css('height',newHeight + 'px');
}
});
$('.close').click(function() {
$('#panel').css('height','0');
});