本文介绍了PrettyPhoto Jquery灯箱链接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是梦幻般的PrettyPhoto Lightbox,它是Jquery lightbox的克隆.

I am using the fantastic PrettyPhoto Lightbox, a Jquery lightbox clone.

要使用iframe启动灯箱,请输入代码

To launch a lightbox with an iframe this is the code

<a href="http://www.google.com?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="Google.com opened at 100%">Google.com</a>

这很棒!

问题是我正在使用javascript使用此代码制作div的某些链接

The problem is that I am using javascript to make some of my div's links with this code

<div onclick="http://www.google.com?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" class="menuitem">

不幸的是,这不起作用.我怀疑这是因为DIV不支持rel属性.有人对如何克服这个问题有任何想法吗?

Unfortunately this doesn't work. I suspect that this is because DIV's do not support the rel attribute. Does anyone have any ideas on how to over come this?

感谢您的帮助,

蒂姆

推荐答案

检出插件js文件(jquery.prettyPhoto.js)的第87行

Check out line 87 of the plugin js file (jquery.prettyPhoto.js)

$('a[rel*='+theGallery+']').each(function(i){

它专门在寻找'a'元素.您可以浏览插件,并进行一些更改以使其满足您的需求.

It is specifically looking for 'a' elements. You could look through the plugin and change a few things to make it work for your needs.

$('div[rel*='+theGallery+']').each(function(i){

我应该补充一点,我认为rel不是有效的div属性.您可能要使用类或其他一些可选属性.

I should add that I don't think rel is a valid div attribute. You may want to use a class or some other selectable attribute.

这篇关于PrettyPhoto Jquery灯箱链接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 22:52