Мне действительно нужна помощь здесь! У меня есть страница с изображениями в группах по 1, 2 или 3. Я нажимаю на изображение, и класс отправляется в некоторый jquery-файл ajax для получения id (mysql), после чего он отправляется в php-файл для создания html для изображений, отображаемых на div на моей странице. Этот бит работает нормально, но я пытаюсь использовать плагин galleria, чтобы показать изображение, которое было отправлено, но он просто действует, как galleria, нет! Если я жестко задаю некоторые изображения в погружении. galleria работает так, как должно!Может ли Galleria использоваться с данными ajax?
вот мой project.js файл
// whenever a link with category class is clicked
$('a.project').click(function(e) {
// first stop the link to go anywhere
e.preventDefault();
// you can get the text of the link by converting the clicked object to string
// you something like 'http://mysite/categories/1'
// there might be other methods to read the link value
var linkText = new String(this);
// the value after the last/is the category ID
var projectvalue = linkText.substring(linkText.lastIndexOf('/') + 1);
// send the category ID to the showprojects.php script using jquery ajax post method
// send along a category ID
// on success insert the returned text into the shownews div
$.post('../inc/showprojects.php', {project: projectvalue}, function(data) {
$('#shownews').html(data);
});
});
Это мой showproducts.php файл
<?php
include 'connect.php';
// if no project was sent, display some error message
if(!isset($_POST['project'])) {
die('No project has been chosen');
}
// cast the project to integer (just a little bit of basic security)
$project = (int) $_POST['project'];
// this will be the string that you will return into the shownews div
$returnHtml = '';
$q = "SELECT * FROM projects WHERE id='$project'";
if($r = mysql_query($q)) {
// construct the html to return
while($row = mysql_fetch_array($r)) {
$returnHtml .= "<img src='{$row['filename']}' />";
$returnHtml .= "<img src='{$row['filename1']}' />";
$returnHtml .= "<img src='{$row['filename2']}' />";
}
}
// display the html (you actually return it this way)
echo $returnHtml;
?>
Это, как я звоню Галериа на DIV
// Load the classic theme
Galleria.loadTheme('../galleria/themes/classic/galleria.classic.min.js');
// Initialize Galleria
$('#shownews').galleria();
Может кто-нибудь мне помочь?
Благодаря
какая ошибка вы получаете ?? –
У меня нет ошибок, изображения добавляются в div, но на div нет галереи! Как я уже сказал, если я жестко рисую изображения в div, то galleria показывается и работает так, как должно! –