Isotope와 Lightbox를 이용한 갤러리형 최신게시글입니다. 사용방법 [code] <div class="latest_wr"> <!-- 사진 최신글2 { --> ...
이미지 비교 게시판
두개의 사진을 슬라이드로 이동하면서 비교해볼 수 있는 게시판입니다.
basic게시판을 커스텀했습니다.
원소스: https://www.w3schools.com/howto/howto_js_image_comparison.asp
여분필드를 3개 사용하였습니다.
압축을 풀면 image_compare라는 폴더가 나옵니다.
이것을 그누보드 순정기준 skin/board/image_compare가 되게 업로드해줍니다.
pc용입니다. 모바일용은 테스트과정에서 크기가 안맞는등 오류가 발생해서 차후에 보완하겠습니다.
wr_1: 슬리이드의 위치 버튼의 위치를 숫자로 입력합니다 wr_1: 1:오른쪽, 2:가운데, 2~500사이:왼쪽에서 가운데 사이 적당히 위치
wr_2: 첫째 이미지 예: http://example.com/images/suzy1.png
wr_3: 둘째 이미지 예: http://example.com/images/suzy2.png
감사합니다 ^^

* view.skin.php
[code]
<!-- Image Comparison -->
<style>
*{box-sizing: border-box;}
.img-comp-container{
position: relative;
height:540px;
}
.img-comp-img{
position: absolute;
width:auto;
height:auto;
overflow:hidden;
}
.img-comp-img img{
display:block;
vertical-align: middle;
}
.img-comp-slider{
position: absolute;
z-index: 9;
cursor: ew-resize;
/* set the appearance of the slider */
width:40px; height: 40px; background-color:#2196f3; opacity: 0.7;border-radius: 50%;
}
</style>
<script>
function initComparisons() {
var x, i;
/*find all elements with an "overlay" class:*/
x = document.getElementsByClassName("img-comp-overlay");
for (i = 0; i < x.length; i++) {
/*once for each "overlay" element:
pass the "overlay" element as a parameter when executing the compareImages function:*/
compareImages(x[i]);
}
function compareImages(img) {
var slider, img, clicked = 0, w, h;
/*get the width and height of the img element*/
w = img.offsetWidth;
h = img.offsetHeight;
/*set the width of the img element to 50%:*/
img.style.width = (w / '<?php echo $view['wr_1']; // 슬라이드버튼위치 ?>') + "px";
/*create slider:*/
slider = document.createElement("DIV");
slider.setAttribute("class", "img-comp-slider");
/*insert slider*/
img.parentElement.insertBefore(slider, img);
/*position the slider in the middle:*/
slider.style.top = (h / 2) - (slider.offsetHeight / 2) + "px";
slider.style.left = (w / '<?php echo $view['wr_1']; // first large image ?>') - (slider.offsetWidth / 2) + "px";
/*execute a function when the mouse button is pressed:*/
slider.addEventListener("mousedown", slideReady);
/*and another function when the mouse button is released:*/
window.addEventListener("mouseup", slideFinish);
/*or touched (for touch screens:*/
slider.addEventListener("touchstart", slideReady);
/*and released (for touch screens:*/
window.addEventListener("touchend", slideFinish);
function slideReady(e) {
/*prevent any other actions that may occur when moving over the image:*/
e.preventDefault();
/*the slider is now clicked and ready to move:*/
clicked = 1;
/*execute a function when the slider is moved:*/
window.addEventListener("mousemove", slideMove);
window.addEventListener("touchmove", slideMove);
}
function slideFinish() {
/*the slider is no longer clicked:*/
clicked = 0;
}
function slideMove(e) {
var pos;
/*if the slider is no longer clicked, exit this function:*/
if (clicked == 0) return false;
/*get the cursor's x position:*/
pos = getCursorPos(e)
/*prevent the slider from being positioned outside the image:*/
if (pos < 0) pos = 0;
if (pos > w) pos = w;
/*execute a function that will resize the overlay image according to the cursor:*/
slide(pos);
}
function getCursorPos(e) {
var a, x = 0;
e = (e.changedTouches) ? e.changedTouches[0] : e;
/*get the x positions of the image:*/
a = img.getBoundingClientRect();
/*calculate the cursor's x coordinate, relative to the image:*/
x = e.pageX - a.left;
/*consider any page scrolling:*/
x = x - window.pageXOffset;
return x;
}
function slide(x) {
/*resize the image:*/
img.style.width = x + "px";
/*position the slider:*/
slider.style.left = img.offsetWidth - (slider.offsetWidth / 2) + "px";
}
}
}
</script>
</head>
<body>
<div class="img-comp-container">
<div class="img-comp-img">
<img src="<?php echo $view['wr_2']; // first image ?>" alt="" width="960" height="540">
</div>
<div class="img-comp-img img-comp-overlay">
<img src="<?php echo $view['wr_3']; // second image ?>" width="960" height="540" alt="">
</div>
</div>
<script>
/*Execute a function that will execute an image compare function for each element with the img-comp-overlay class:*/
initComparisons();
</script>
<!-- Image Comparison -->
[/code]
* write.skin.php
[code]
<!-- Image Compare -->
<!-- Slide Button Positon -->
<!-- 1: 버튼이 오른쪽에 위치, 2: 버튼이 가운데 위치, 2~500사이: 왼쪽에서 가운데 사이에 버튼이 위치. -->
<input type=text class="frm_input full_input" name="wr_1" value="<?php echo $write['wr_1']; ?>" placeholder="버튼의 위치를 숫자로 입력합니다 wr_1: 1:오른쪽, 2:가운데, 2~500사이:왼쪽에서 가운데 사이 적당히 위치 ">
<!-- first image -->
<input type=text class="frm_input full_input" name="wr_2" value="<?php echo $write['wr_2']; ?>" placeholder="이미지경로 wr_2:예 http://example.com/images/suzy1.png ">
<!-- second image -->
<input type=text class="frm_input full_input" name="wr_3" value="<?php echo $write['wr_3']; ?>" placeholder="이미지경로 wr_3:예 http://example.oom/images/suzy2.png ">
<!-- Image Compare -->
[/code]
버전 정보
첨부파일
그누보드5 스킨
2,751건좋은 댓글과 좋아요는 제작자에게 큰힘이 됩니다.
우선 그누보드도 잘 못다루고 실력은 그냥 초보입니다. 제가 필요해서 필요한것만 짤라서 대충 몇가지만 바꾸어 보았습니다. 여기 올릴수 있는 스킨인지도 모르겠네요. 혹시 안된다면 내...
두개의 사진을 슬라이드로 이동하면서 비교해볼 수 있는 게시판입니다. basic게시판을 커스텀했습니다. 원소스: https://www.w3schools.com/howto/howt...
팁자료실 Owl Carousel 사용하기 : https://sir.kr/g5_tip/19201 Magnific Popup 사용하기 : https://sir.kr/g5_tip/192...
나리야용 갤러리 위젯입니다. 사용방법 [code] <!-- 위젯 시작 { --> <h3 class="h3 f-lg en"> <a href="<?ph...
이윰빌더용 새글DB복구 그누보드5 버전 : 5.5.8.2 이윰빌더 버전 : 4.5.4
https://sir.kr/qa/472708 게시판의 new 게시글 개수를 표현할 수 있나요?
https://sir.kr/qa/471382 게시판이 3개가 있는데, 이 중 조회수 가장 높은순으로 5개 글을 가져오려고 합니다. index.php <div st...
1. 첨부파일의 압축을 풀고 basic 또는 gallery 게시판의 pc와 모바일 각각의 디렉토리에 media 폴더와 write.head.skin.php 와 view.head.sk...
그누보드용 뉴스티커입니다. [사용방법] 옵션설정은 latest.skin.php파일의 주석을 참고하시면 됩니다. [code] <style> .w-bo...
댓글 33개
파이팅이란 말에서 힘이 납니다^^
<div id="logo">부분에서 로고를 <h1>태그로 바꾼 것입니다.
<style>
.glowkim {
font-size: 25px;
color: #fff;
text-align: center;
animation: glowkim 2s ease-in-out infinite alternate;
}
@-webkit-keyframes glowkim {
from {
text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073;
}
to {
text-shadow: 0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6, 0 0 50px #ff4da6, 0 0 60px #ff4da6, 0 0 70px #ff4da6, 0 0 80px #ff4da6;
}
}
</style>
<div id="hd_wrapper">
<div id="logo">
<a href="<?php echo G5_URL ?>">
<h1 id="kims" class="glowkim" style="font-size: 20px; float: left; text-align:right; color: white; padding-top: 5px;" title="이은경시인 홈페이지">Poetry is Life !!</h1>
</a>
<!--이미지를 주석처리하고 텍스트로 바꾼다. <img src="<?php echo G5_IMG_URL ?>/logo.png" alt="<?php echo $config['cf_title']; ?>">-->
</div>
원소스 출처: https://www.w3schools.com/howto/howto_css_glowing_text.asp
관심을 가져주셔서 감사드립니다^^
공개 감사합니다.
비타주리님의 스킨을 보면 자바스크립트 함수를 직접 만들어 사용하시는데요.
늘 말씀드리지만 비타주리님 스킨을 보고 많이 배웁니다.
따뜻한 관심에 감사드립니다^^
view.skin.php의 90번째 줄 부근의 파일 출력부분을 주석처리합니다.
<?php
// 파일 출력
// $v_img_count = count($view['file']);
// if($v_img_count) {
// echo "<div id=\"bo_v_img\">\n";
//
// foreach($view['file'] as $view_file) {
// echo get_file_thumbnail($view_file);
// }
//
// echo "</div>\n";
// }
?>
그리고
221번째 줄에서
img src부분을 바꾸어줍니다.
기존 여분필드를 사용하는 코드
<div class="img-comp-container">
<div class="img-comp-img">
<img src="<?php echo $view['wr_2']; // first large image ?>" alt="" width="960" height="540">
</div>
<div class="img-comp-img img-comp-overlay">
<img src="<?php echo $view['wr_3']; // first large image ?>" width="960" height="540" alt="">
</div>
</div>
파일업로드를 사용하는코드
<div class="img-comp-container">
<div class="img-comp-img">
<img src="<?php echo $view['file'][0]['file'] ? $view['file'][0]['path'].'/'.$view['file'][0]['file'] : '' ?>" alt="" width="960" height="540">
</div>
<div class="img-comp-img img-comp-overlay">
<img src="<?php echo $view['file'][1]['file'] ? $view['file'][1]['path'].'/'.$view['file'][1]['file'] : '' ?>" width="960" height="540" alt="">
</div>
</div>
첫째, 둘째 업로드한 파일이 나타납니다.
파일출력부분을 주석처리하지 않으면 업로드한 파일이 2중으로 출력이 됩니다.