修改colorbox插件调用方法

This commit is contained in:
Li Jianxuan 2013-04-16 07:19:19 +00:00
parent a91a837b6a
commit c5c557bf58
3 changed files with 6 additions and 18 deletions

View File

@ -22,7 +22,7 @@ $this->theme->AppendPlus($this,'colorbox');
<?php foreach($this->metadata as $md) : ?> <?php foreach($this->metadata as $md) : ?>
<div class="mditem"> <div class="mditem">
<div class="thumb"> <div class="thumb">
<a href="javascript:void(0);" class="gallery" rel="/service/bigthumb/uuid/<?= $md['uuid'] ?>"> <a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="colorbox">
<img src="/service/thumb/id/<?php echo $md['id'];?>" /> <img src="/service/thumb/id/<?php echo $md['id'];?>" />
</a> </a>
</div> </div>
@ -55,9 +55,5 @@ foreach($this->keywords as $cg) :
</fieldset></div> </fieldset></div>
<?php endif; ?> <?php endif; ?>
<script> <script>
$('a.gallery').bind('click',function(){ $(".colorbox").colorbox({photo:"true"});
$.colorbox({
photo:$(this).attr('rel'),
});
});
</script> </script>

View File

@ -17,7 +17,7 @@ $this->theme->AppendPlus($this,'colorbox');
<?php foreach($this->metadata as $md) : ?> <?php foreach($this->metadata as $md) : ?>
<li class="items"> <li class="items">
<h4><a href="/data/<?php echo $md['uuid'];?>"><?= $this->escape($md['title']);?></a></h4> <h4><a href="/data/<?php echo $md['uuid'];?>"><?= $this->escape($md['title']);?></a></h4>
<a href="javascript:void(0);" class="thumbnail gallery" rel="/service/bigthumb/uuid/<?= $md['uuid'] ?>"> <a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="thumbnail colorbox">
<img src="/service/thumb/id/<?php echo $md['id'];?>" alt=""> <img src="/service/thumb/id/<?php echo $md['id'];?>" alt="">
</a> </a>
<div class="caption"> <div class="caption">
@ -39,11 +39,7 @@ $(function(){
itemSelector : '.items', itemSelector : '.items',
//columnWidth : 240 //columnWidth : 240
}); });
$('a.gallery').bind('click',function(){ $(".colorbox").colorbox({photo:"true"});
$.colorbox({
photo:$(this).attr('rel'),
});
});
}); });
</script> </script>

View File

@ -24,7 +24,7 @@ $this->theme->AppendPlus($this,'masonry');
<?php foreach($this->metadata as $md) : ?> <?php foreach($this->metadata as $md) : ?>
<li class="items"> <li class="items">
<h4><a href="/heihe/view/uuid/<?php echo $md['uuid'];?>"><?= $this->escape($md['title']);?></a></h4> <h4><a href="/heihe/view/uuid/<?php echo $md['uuid'];?>"><?= $this->escape($md['title']);?></a></h4>
<a href="javascript:void(0);" class="thumbnail gallery" rel="/service/bigthumb/uuid/<?= $md['uuid'] ?>"> <a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="thumbnail colorbox">
<img src="/service/thumb/id/<?php echo $md['id'];?>" alt=""> <img src="/service/thumb/id/<?php echo $md['id'];?>" alt="">
</a> </a>
<div class="caption"> <div class="caption">
@ -44,11 +44,7 @@ $this->theme->AppendPlus($this,'masonry');
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
$(document).ready(function(){ $(document).ready(function(){
$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"}); $(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
$('a.gallery').bind('click',function(){ $(".colorbox").colorbox({photo:"true"});
$.colorbox({
photo:$(this).attr('rel'),
});
});
}); });
$('#container').masonry({ $('#container').masonry({
itemSelector : '.items', itemSelector : '.items',