mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
issue 2875. fixed a bug. opend image's position is not center. size is not 100%.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12642 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3475fbd685
commit
657e715f26
2 changed files with 11 additions and 8 deletions
|
|
@ -16,18 +16,18 @@ function getScreen() {
|
|||
xScreen = $("<div>")
|
||||
.attr("id","xe_gallery_screen")
|
||||
.css({
|
||||
position:"absolute",
|
||||
position:"fixed",
|
||||
display:"none",
|
||||
backgroundColor:"black",
|
||||
zIndex:500,
|
||||
opacity:0.5
|
||||
opacity:0.7
|
||||
});
|
||||
|
||||
// 이미지를 보여주고 컨트롤 버튼을 다룰 레이어
|
||||
controls = $("<div>")
|
||||
.attr("id","xe_gallery_controls")
|
||||
.css({
|
||||
position:"absolute",
|
||||
position:"fixed",
|
||||
display:"none",
|
||||
overflow:"hidden",
|
||||
zIndex:510
|
||||
|
|
@ -77,8 +77,11 @@ function getScreen() {
|
|||
// 이미지 홀더
|
||||
imgframe = $("<img>")
|
||||
.attr("id", "xe_gallery_holder")
|
||||
.css("border", "7px solid white")
|
||||
.css("zIndex", 520)
|
||||
.css({
|
||||
border: '7px solid white',
|
||||
zindex: 520,
|
||||
'max-width': 'none'
|
||||
})
|
||||
.appendTo(controls).draggable();
|
||||
|
||||
body.append(xScreen).append(controls);
|
||||
|
|
@ -130,8 +133,8 @@ function getScreen() {
|
|||
if(!src) src = this.list.eq(this.index).attr("src");
|
||||
|
||||
imgframe.attr("src", src).css({
|
||||
left : Math.round( Math.max( parseInt($(document).scrollLeft()) + (clientWidth-imgframe.width()-14)/2, 0 ) ) + "px",
|
||||
top : Math.round( Math.max( parseInt($(document).scrollTop()) + (clientHeight-imgframe.height()-14)/2, 0 ) ) + "px"
|
||||
left : Math.round( parseInt($(document).scrollLeft()) + (clientWidth-imgframe.width()-14)/2, 0 ) + "px",
|
||||
top : Math.round( parseInt($(document).scrollTop()) + (clientHeight-imgframe.height()-14)/2, 0 ) + "px"
|
||||
});
|
||||
|
||||
closebtn.css({
|
||||
|
|
|
|||
2
addons/resize_image/js/resize_image.min.js
vendored
2
addons/resize_image/js/resize_image.min.js
vendored
|
|
@ -2,6 +2,6 @@
|
|||
* @brief 화면내에서 상위 영역보다 이미지가 크면 리사이즈를 하고 클릭시 원본을 보여줄수 있도록 변경
|
||||
**/
|
||||
(function($){var xScreen=null
|
||||
function getScreen(){var body=$(document.body),controls,imgframe,closebtn,prevbtn,nextbtn;if(!xScreen){xScreen=$("<div>").attr("id","xe_gallery_screen").css({position:"absolute",display:"none",backgroundColor:"black",zIndex:500,opacity:0.5});controls=$("<div>").attr("id","xe_gallery_controls").css({position:"absolute",display:"none",overflow:"hidden",zIndex:510});closebtn=$("<img>").attr("id","xe_gallery_closebtn").attr("src",request_uri+"addons/resize_image/iconClose.png").css({top:"10px"}).click(function(){xScreen.xeHide()}).appendTo(controls);prevbtn=$("<img>").attr("id","xe_gallery_prevbtn").attr("src",request_uri+"addons/resize_image/iconLeft.png").css("left","10px").click(function(){xScreen.xePrev()}).appendTo(controls);nextbtn=$("<img>").attr("id","xe_gallery_nextbtn").attr("src",request_uri+"addons/resize_image/iconRight.png").css("right","10px").click(function(){xScreen.xeNext()}).appendTo(controls);controls.find("img").attr({width:60,height:60,className:"iePngFix"}).css({position:"absolute",width:"60px",height:"60px",zIndex:530,cursor:"pointer"});imgframe=$("<img>").attr("id","xe_gallery_holder").css("border","7px solid white").css("zIndex",520).appendTo(controls).draggable();body.append(xScreen).append(controls);xScreen.xeShow=function(){var clientWidth=$(window).width(),clientHeight=$(window).height();$("#xe_gallery_controls,#xe_gallery_screen").css({display:"block",width:$(document).width()+"px",height:$(document).height()+"px",left:0,top:0});closebtn.css("left",Math.round((clientWidth-60)/2)+"px");$("#xe_gallery_prevbtn,#xe_gallery_nextbtn").css("top",Math.round((clientHeight-60)/2)+"px");this.xeMove(0)};xScreen.xeHide=function(event){xScreen.css("display","none");controls.css("display","none")};xScreen.xePrev=function(){this.xeMove(-1)};xScreen.xeNext=function(){this.xeMove(1)};xScreen.xeMove=function(val){var clientWidth=$(window).width(),clientHeight=$(window).height();this.index+=val;prevbtn.css("visibility",(this.index>0)?"visible":"hidden");nextbtn.css("visibility",(this.index<this.list.size()-1)?"visible":"hidden");var src=this.list.eq(this.index).attr("rawsrc");if(!src)src=this.list.eq(this.index).attr("src");imgframe.attr("src",src).css({left:Math.round(Math.max(parseInt($(document).scrollLeft())+(clientWidth-imgframe.width()-14)/2,0))+"px",top:Math.round(Math.max(parseInt($(document).scrollTop())+(clientHeight-imgframe.height()-14)/2,0))+"px"});closebtn.css({left:Math.round(Math.max(parseInt($(document).scrollLeft())+(clientWidth-closebtn.width())/2,0))+"px",top:Math.round(Math.max(parseInt($(document).scrollTop())+10,0))+"px"})};$(document).keydown(xScreen.xeHide)}else{controls=$("#xe_gallery_controls");imgframe=$("#xe_gallery_holder");closebtn=$("#xe_gallery_closebtn");prevbtn=$("#xe_gallery_prevbtn");nextbtn=$("#xe_gallery_nextbtn")};return xScreen}
|
||||
function getScreen(){var body=$(document.body),controls,imgframe,closebtn,prevbtn,nextbtn;if(!xScreen){xScreen=$("<div>").attr("id","xe_gallery_screen").css({position:"fixed",display:"none",backgroundColor:"black",zIndex:500,opacity:0.7});controls=$("<div>").attr("id","xe_gallery_controls").css({position:"fixed",display:"none",overflow:"hidden",zIndex:510});closebtn=$("<img>").attr("id","xe_gallery_closebtn").attr("src",request_uri+"addons/resize_image/iconClose.png").css({top:"10px"}).click(function(){xScreen.xeHide()}).appendTo(controls);prevbtn=$("<img>").attr("id","xe_gallery_prevbtn").attr("src",request_uri+"addons/resize_image/iconLeft.png").css("left","10px").click(function(){xScreen.xePrev()}).appendTo(controls);nextbtn=$("<img>").attr("id","xe_gallery_nextbtn").attr("src",request_uri+"addons/resize_image/iconRight.png").css("right","10px").click(function(){xScreen.xeNext()}).appendTo(controls);controls.find("img").attr({width:60,height:60,className:"iePngFix"}).css({position:"absolute",width:"60px",height:"60px",zIndex:530,cursor:"pointer"});imgframe=$("<img>").attr("id","xe_gallery_holder").css({border:'7px solid white',zindex:520,'max-width':'none'}).appendTo(controls).draggable();body.append(xScreen).append(controls);xScreen.xeShow=function(){var clientWidth=$(window).width(),clientHeight=$(window).height();$("#xe_gallery_controls,#xe_gallery_screen").css({display:"block",width:$(document).width()+"px",height:$(document).height()+"px",left:0,top:0});closebtn.css("left",Math.round((clientWidth-60)/2)+"px");$("#xe_gallery_prevbtn,#xe_gallery_nextbtn").css("top",Math.round((clientHeight-60)/2)+"px");this.xeMove(0)};xScreen.xeHide=function(event){xScreen.css("display","none");controls.css("display","none")};xScreen.xePrev=function(){this.xeMove(-1)};xScreen.xeNext=function(){this.xeMove(1)};xScreen.xeMove=function(val){var clientWidth=$(window).width(),clientHeight=$(window).height();this.index+=val;prevbtn.css("visibility",(this.index>0)?"visible":"hidden");nextbtn.css("visibility",(this.index<this.list.size()-1)?"visible":"hidden");var src=this.list.eq(this.index).attr("rawsrc");if(!src)src=this.list.eq(this.index).attr("src");imgframe.attr("src",src).css({left:Math.round(parseInt($(document).scrollLeft())+(clientWidth-imgframe.width()-14)/2,0)+"px",top:Math.round(parseInt($(document).scrollTop())+(clientHeight-imgframe.height()-14)/2,0)+"px"});closebtn.css({left:Math.round(Math.max(parseInt($(document).scrollLeft())+(clientWidth-closebtn.width())/2,0))+"px",top:Math.round(Math.max(parseInt($(document).scrollTop())+10,0))+"px"})};$(document).keydown(xScreen.xeHide)}else{controls=$("#xe_gallery_controls");imgframe=$("#xe_gallery_holder");closebtn=$("#xe_gallery_closebtn");prevbtn=$("#xe_gallery_prevbtn");nextbtn=$("#xe_gallery_nextbtn")};return xScreen}
|
||||
function slideshow(event){var container=$(this).closest('.xe_content'),imglist=container.find("img[rel=xe_gallery]"),currentIdx=$.inArray($(this).get(0),imglist.get()),xScreen=getScreen();xScreen.list=imglist;xScreen.index=currentIdx;xScreen.xeShow()};$(function(){var regx_skip=/(?:(modules|addons|classes|common|layouts|libs|widgets|widgetstyles)\/)/i,regx_allow_i6pngfix=/(?:common\/tpl\/images\/blank\.gif$)/i,dummy=$('<div style="height:1; overflow:hidden; opacity:0; display:block; clear:both;"></div>')
|
||||
function doResize(contentWidth,count){if(!count)count=0;if(count>=10)return;var $img=this,beforSize={width:$img.width(),height:$img.height()};if(!beforSize.width||!beforSize.height){setTimeout(function(){doResize.call($img,contentWidth,++count)},200);return};if(beforSize.width<=contentWidth)return;var resize_ratio=contentWidth/beforSize.width;$img.removeAttr('width').removeAttr('height').css({width:contentWidth,height:parseInt(beforSize.height*resize_ratio,10)})};$('div.xe_content').each(function(){var contentWidth=dummy.appendTo(this).width();dummy.remove();if(!contentWidth)return;$('img',this).each(function(){var $img=$(this),imgSrc=$img.attr('src');if(regx_skip.test(imgSrc)&&!regx_allow_i6pngfix.test(imgSrc))return;$img.attr('rel','xe_gallery');doResize.call($img,contentWidth)});$('img[rel=xe_gallery]',this).live('mouseover',function(){var $img=$(this);if(!$img.parent('a').length&&!$img.attr('onclick'))$img.css('cursor','pointer').click(slideshow)})})})})(jQuery)
|
||||
Loading…
Add table
Add a link
Reference in a new issue