Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated with embed tag for non image-video #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/components/LightBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
name="fade"
>
<img
v-if="media[select].type !== 'video'"
v-if="/image/.test(media[select].type)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
v-if="/image/.test(media[select].type)"
v-if="media[select].type === "image""

:key="media[select].src"
:src="media[select].src"
:srcset="media[select].srcset || ''"
class="vue-lb-modal-image"
:alt="media[select].caption"
>
<video
v-else
v-else-if="media[select].type == 'video'"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
v-else-if="media[select].type == 'video'"
v-else-if="media[select].type === 'video'"

ref="video"
controls
:key="media[select].sources[0].src"
Expand All @@ -52,6 +52,15 @@
:type="source.type"
>
</video>

<embed
v-else
ref="object"
:src="media[select].src"
class="vue-lb-modal-image"
/>


</transition>

<slot name="customCaption">
Expand Down Expand Up @@ -105,7 +114,7 @@
@click.stop="showImage(index)"
>
<slot
v-if="image.type"
v-if="image.type=='video'"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
v-if="image.type=='video'"
v-if="image.type === 'video'"

name="videoIcon"
>
<VideoIcon />
Expand Down
5 changes: 5 additions & 0 deletions src/components/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ img.vue-lb-modal-image {
-ms-user-select: none;
}

embed.vue-lb-modal-image {
min-width: 80vw;
min-height: 80vh;
}

.vue-lb-info {
visibility: initial;
position: absolute;
Expand Down
3 changes: 2 additions & 1 deletion src/dummy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ const media = [
thumb: 'https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg',
src: 'https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg',
caption: '<h4>Elephant</h4>',
type: 'image/jpg'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
type: 'image/jpg'
type: 'image'

Is jpg really need?

Copy link

@janosrusiczki janosrusiczki Jul 7, 2020

Choose a reason for hiding this comment

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

No it's not, this is not mime type, type is used by the lightbox to determine how to show the media.

},
{
thumb: 'https://i-kinhdoanh.vnecdn.net/2018/06/18/1-1529296929_680x0.jpg',
src: 'https://i-kinhdoanh.vnecdn.net/2018/06/18/1-1529296929_680x0.jpg',
src: 'https://sandbox.anmup.online/storage/post/f7177163c833dff4b38fc8d2872f1ec6/qfxcinemas-ticket.pdf',

Choose a reason for hiding this comment

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

This link asks me for a password.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use a public link

caption: '<h4>Messi</h4>',
},
{
Expand Down