我正在尝试将默认灯箱'modal'替换为'slimbox',因为'modal'没有导航箭头。
Demo of slimbox with navigations
Demo of modal without navigations
我正在使用这些路径来修改slimbox的调用
[TEMPLATENAME] /html/com_virtuemart/productdetails/default.php 组件/ com_virtuemart /产品详细/如default.php
Joomla v2.5 Virtuemart 2.0.6 Slimbox2
以下是我的尝试:
//Enable Slimbox2 plugin
$front = JURI::root(true).'/components/com_virtuemart/assets/';
$document = JFactory::getDocument();
$document->addStyleSheet($front.'js/slimbox/slimbox.css');
$document->addScript($front.'js/slimbox/slimbox2.js');
$js = 'jQuery(document).ready(function($) { $("a.lightbox").slimbox(); });';
$document->addScriptDeclaration($js);
//output thumbnail
echo $this->product->images[0]->displayMediaThumb('class="product-image"',true,'class="lightbox" rel="lightbox"'.$this->product->virtuemart_product_id.'"',true,true);
//unset first image not to be show amont additional ones
unset ($this->product->images[0]);
?>
但它仍然不起作用我想知道什么是错的?
[参考文献] [3]
答案 0 :(得分:0)
您没有将slimbox类应用于图像参考,将它应用于图像的容器不是吗?在我看来,您需要直接处理图像文件URL。
// get the file_url of the first image
$imgPath = $this->product->images[0]->file_url;
// output the image
<a class="slimbox" href="<?php echo $imgPath; ?>">
<img src="<?php echo $imgPath; ?>" alt="" />
</a>