* finish task #6180.
This commit is contained in:
+27
-6
@@ -91,17 +91,38 @@ function setFormAction(actionLink, hiddenwin, obj)
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setImageSize(image, maxWidth)
|
||||
function setImageSize(image, maxWidth, maxHeight)
|
||||
{
|
||||
var $image = $(image);
|
||||
if($image.parent().prop('tagName').toLowerCase() == 'a') return;
|
||||
|
||||
/* If not set maxWidth, set it auto. */
|
||||
if(!maxWidth)
|
||||
{
|
||||
bodyWidth = $('body').width();
|
||||
maxWidth = bodyWidth - 470; // The side bar's width is 336, and add some margins.
|
||||
}
|
||||
if(!maxHeight) maxHeight = $(window).height();
|
||||
|
||||
if($(image).width() > maxWidth) $(image).attr('width', maxWidth);
|
||||
$(image).wrap('<a href="' + $(image).attr('src') + '" target="_blank"></a>');
|
||||
setTimeout(function()
|
||||
{
|
||||
if($image.width() > maxWidth) $image.attr('width', maxWidth);
|
||||
$image.wrap('<a href="' + $image.attr('src') + '" style="display:block;position:relative;overflow:hidden;max-height:' + maxHeight + 'px" target="_blank"></a>');
|
||||
if($image.height() > maxHeight) $image.closest('a').append("<a href='###' class='showMoreImage' onclick='showMoreImage(this)'><i class='icon-angle-down'></i></a>");
|
||||
}, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show more image when image is too height.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function showMoreImage(obj)
|
||||
{
|
||||
$(obj).parents('a').css('max-height', 'none');
|
||||
$(obj).remove();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -734,10 +755,10 @@ function convertURL()
|
||||
|
||||
$('.article-content, .article>.content').each(function()
|
||||
{
|
||||
var aTags = [];
|
||||
var aTags = [];
|
||||
var iframeTags = [];
|
||||
var imgTags = [];
|
||||
var content = $(this).html();
|
||||
var imgTags = [];
|
||||
var content = $(this).html();
|
||||
$(this).find('a').each(function(i)
|
||||
{
|
||||
aTags[i] = $(this).prop('outerHTML');
|
||||
|
||||
@@ -33,3 +33,17 @@
|
||||
|
||||
.modal-title{font-size: 14px;}
|
||||
.fixed-footer .text {color: #fff;}
|
||||
|
||||
a.showMoreImage {
|
||||
display: block;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
background: #888;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
opacity: 0.7;
|
||||
text-align: center;
|
||||
color:red;
|
||||
}
|
||||
a.showMoreImage:hover{opacity: 1;}
|
||||
|
||||
Reference in New Issue
Block a user