3

我正在使用 Galleria 进行幻灯片放映。我想在stage.

我有“更大”按钮的代码:

this.fullres = this.create('div', 'fullres');
this.get('fullres').innerHTML = '<a href="#">Larger</a>';
this.appendChild('fullres', this.fullres);

我有这段代码将每个<img>'srel=标签分配给页面自定义字段中的全尺寸图像 URL:

<img ... rel="<?=$attachments[$i]['fullres']?>" />

使用 JQuery,我希望提取active图像的rel=标签值并附加.fullres href标签。这是我到目前为止的代码,但它不起作用:

var title = $(.images).attr('rel'); // pulls the fullres url from the rel tag
$('.galleria-fullres').attr('href', ); //append the galleria fullres href with the rel info
4

2 回答 2

0

我不得不说我看不出这是如何工作的......

你知道你有一个错字:$(.images)?应该是$('.images')

您是否故意遗漏了第二个参数$('.galleria-fullres').attr('href', );?这不应该$('.galleria-fullres').attr('href', title);吗?

jquery 如何通过类引用元素来工作?您将获得一系列元素,而不仅仅是一个。我想这只是您代码的摘录?我错过了什么吗?

您能否发布在浏览器中看到的这些元素示例的 html?这应该是一件很容易的事情,但我真的无法仅凭这些线条看到整个画面。

于 2011-02-01T19:16:05.700 回答
0

Galleria 真的不是那样运作的。但是您可以做的是创建一个按钮以进入全屏并在全屏时显示更大的图像。

像这样的东西:

$('#galleria').galleria({
    // other galleria options here
    dataConfig: function( img ) {
        // get the fullscreen image
        return {
            big: $( img ).attr('rel')
        };
    }
});

var galleria = Galleria.get(0);

$('#fullscreen-button').click(function() {
    galleria.enterFullscreen();
});
于 2011-04-09T22:59:38.893 回答