-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia-room.php
115 lines (102 loc) · 2.99 KB
/
media-room.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/*
______ _____ _______ _______ _______ _______ ______ _______
| __ \ |_| ___|_ _| | | | __ \ _ |
| __/ | ___| | | | | - | < |
|___| |_______|_______| |___| |___|___|_______|___|__|___|___|
P L E T H O R A T H E M E S . C O M (c) 2016
Single View Template Parts / Media, according to post format ( image, audio or video )
media_template_name: Four Views
media_template_desc: Display four views of the room provided you have uploaded 4 images
*/
$options = get_query_var( 'options' );
if ( is_array( $options ) ) { extract($options); }
if ( $post_format === 'gallery' ) { ?>
<!-- CSS -->
<style>
.custom_media_room {
display : flex;
flex-direction : row;
flex-wrap : wrap;
position : relative;
}
.custom_media_room img {
transition : all 700ms ease;
height : 50%;
width : 50%;
z-index : 99;
}
.custom_media_room img:hover {
opacity : 0.75;
cursor : pointer;
}
.custom_media_room img.current_room {
height : 100%;
width : 100%;
}
.custom_media_room img.scale_down {
height : 0%;
width : 0%;
}
.custom_media_room .current_image {
width : 100%;
height : 100%;
z-index : -1;
position : absolute;
top : 0;
left : 0;
background-repeat : no-repeat;
background-size : cover;
transition : 500ms all ease;
opacity : 0;
cursor : pointer;
}
.current_image.ontop { z-index : 1001; }
.current_image.ontop:before,
.current_image.ontop:after {
content : "";
position : absolute;
display : block;
margin : auto;
width : 32px;
height : 0;
border-top : 2px solid rgba(0,0,0,0.7);
right : 8px;
top : 24px;
transform-origin: center;
}
.current_image.ontop:before { transform: rotate(45deg); }
.current_image.ontop:after { transform: rotate(-45deg); }
</style>
<!-- JS -->
<script>
jQuery(function($){
$current_image = $(".current_image");
$current_image.on("click", function(e){
let $this = $(this);
$this.css( "opacity", 0 );
setTimeout(function(){ $this.removeClass('ontop'); }, 250)
});
$(".custom_media_room img").on("click", function(e){
$current_image
.addClass('ontop')
.css({
"background-image" : "url(" + $(this).attr('src') + ")",
"opacity" : 1
});
});
});
</script>
<!-- MARKUP -->
<div class="custom_media_room">
<div class="current_image"></div>
<?php }
echo Plethora_Theme::get_post_media( array(
'type' => $post_format,
'stretch' => true,
'link_to_post' => false,
)
);
if ( $post_format === 'gallery' ) { ?>
</div>
<?php }