Skip to content

Commit

Permalink
Merge pull request #379 from cshijiel/master
Browse files Browse the repository at this point in the history
Add title to article and fancybox title;custum css on title
  • Loading branch information
iissnan committed Sep 18, 2015
2 parents ae20c8d + 8f1bc2c commit d6d011e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
32 changes: 31 additions & 1 deletion source/css/_custom/custom.styl
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
// Custom styles.
// Custom styles.

.post-body p img {
margin: 0 auto;
cursor: pointer;
cursor: zoom-out;
cursor: -webkit-zoom-in;
display: block!important;
}

.post-body p .pic-title {
margin: 0 auto;
text-align: center;
}

.post-body p .pic-title span {
min-width: 20%;
min-height: 22px;
display: inline-block;
padding: 10px;
margin: 0 auto;
border-bottom: 1px solid #d9d9d9;
font-size: 18px;
color: #999999;
font-style: italic;
line-height: 1.7;
}

.posts-expand .post-body .fancybox img {
margin: 0 auto;
}
10 changes: 7 additions & 3 deletions source/js/fancy-box.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$(document).ready(function() {

$('.content img').each(function () {
var $image = $(this);
var $imageWrapLink = $image.parent('a');
Expand All @@ -7,9 +8,10 @@ $(document).ready(function() {
$imageWrapLink = $image.wrap('<a href="' + this.getAttribute('src') + '"></a>').parent('a');
}
$imageWrapLink.addClass('fancybox');
if(this.title){
$imageWrapLink.attr("title",this.title); //make sure img title tag will show correctly in fancybox
}
if ($image.attr("alt")) {
$imageWrapLink.append('<div class="pic-title"><span>' + $image.attr("alt") + '</span></div>');
$imageWrapLink.attr("title",$image.attr("alt")); //make sure img title tag will show correctly in fancybox
};
});
});
$('.fancybox').fancybox({
Expand All @@ -19,3 +21,5 @@ $('.fancybox').fancybox({
}
}
});


1 comment on commit d6d011e

@geekrainy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom.styl为什么会合并到master?

Please sign in to comment.