thumbnail slider display video and images
My thumbnail slider is working properly for image file. But now i have some video in my slider which will change on click of appropriate thumbnail. for image i am changing the src on thumbnail click. Is it possible to display video on thumbnail click , just doing some changes in my code. Below is my code.
<style>
/* -- thumbnails -- */
#thumbnails {
float:left;
width:120px;
overflow-y: auto;
.thumb {
padding:11px 8px;
cursor: pointer;
}
img {
border: 1px solid #DDD;
cursor: pointer;
width:90px;
height:60px;
}
.frame {
float: left;
padding: 2px;
border: 1px solid #CCC;
}
}
#slider {
#largeImage {
position: absolute;
width: 100%;
height: 100%;
}
}
</style>
<div class="row">
<div class="col-2" id="thumbnails">
<div class="thumb">
<div class="frame"><img src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header2.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header3.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header4.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header5.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header6.jpg" /></div>
</div>
</div>
<div class="col-10">
<img id="largeImage" src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" class="img-fluid"/>
</div>
</div>
<script>
$('#thumbnails img').click(function(){
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
</script>
This http://jsfiddle.net/b6jtwndd/ code is working well for video. find this solution in stackoverflow.
javascript jquery css
add a comment |
My thumbnail slider is working properly for image file. But now i have some video in my slider which will change on click of appropriate thumbnail. for image i am changing the src on thumbnail click. Is it possible to display video on thumbnail click , just doing some changes in my code. Below is my code.
<style>
/* -- thumbnails -- */
#thumbnails {
float:left;
width:120px;
overflow-y: auto;
.thumb {
padding:11px 8px;
cursor: pointer;
}
img {
border: 1px solid #DDD;
cursor: pointer;
width:90px;
height:60px;
}
.frame {
float: left;
padding: 2px;
border: 1px solid #CCC;
}
}
#slider {
#largeImage {
position: absolute;
width: 100%;
height: 100%;
}
}
</style>
<div class="row">
<div class="col-2" id="thumbnails">
<div class="thumb">
<div class="frame"><img src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header2.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header3.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header4.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header5.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header6.jpg" /></div>
</div>
</div>
<div class="col-10">
<img id="largeImage" src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" class="img-fluid"/>
</div>
</div>
<script>
$('#thumbnails img').click(function(){
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
</script>
This http://jsfiddle.net/b6jtwndd/ code is working well for video. find this solution in stackoverflow.
javascript jquery css
What you mean? can you please explain?
– Just code
Dec 21 '18 at 11:24
in my slider, i want to embed youtube video as well. in above example, it,s work well for image . but in my slider i have some video as well. thanks
– shreya_js
Dec 21 '18 at 12:25
add a comment |
My thumbnail slider is working properly for image file. But now i have some video in my slider which will change on click of appropriate thumbnail. for image i am changing the src on thumbnail click. Is it possible to display video on thumbnail click , just doing some changes in my code. Below is my code.
<style>
/* -- thumbnails -- */
#thumbnails {
float:left;
width:120px;
overflow-y: auto;
.thumb {
padding:11px 8px;
cursor: pointer;
}
img {
border: 1px solid #DDD;
cursor: pointer;
width:90px;
height:60px;
}
.frame {
float: left;
padding: 2px;
border: 1px solid #CCC;
}
}
#slider {
#largeImage {
position: absolute;
width: 100%;
height: 100%;
}
}
</style>
<div class="row">
<div class="col-2" id="thumbnails">
<div class="thumb">
<div class="frame"><img src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header2.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header3.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header4.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header5.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header6.jpg" /></div>
</div>
</div>
<div class="col-10">
<img id="largeImage" src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" class="img-fluid"/>
</div>
</div>
<script>
$('#thumbnails img').click(function(){
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
</script>
This http://jsfiddle.net/b6jtwndd/ code is working well for video. find this solution in stackoverflow.
javascript jquery css
My thumbnail slider is working properly for image file. But now i have some video in my slider which will change on click of appropriate thumbnail. for image i am changing the src on thumbnail click. Is it possible to display video on thumbnail click , just doing some changes in my code. Below is my code.
<style>
/* -- thumbnails -- */
#thumbnails {
float:left;
width:120px;
overflow-y: auto;
.thumb {
padding:11px 8px;
cursor: pointer;
}
img {
border: 1px solid #DDD;
cursor: pointer;
width:90px;
height:60px;
}
.frame {
float: left;
padding: 2px;
border: 1px solid #CCC;
}
}
#slider {
#largeImage {
position: absolute;
width: 100%;
height: 100%;
}
}
</style>
<div class="row">
<div class="col-2" id="thumbnails">
<div class="thumb">
<div class="frame"><img src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header2.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header3.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header4.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header5.jpg" /></div>
</div>
<div class="thumb">
<div class="frame"><img src="img/sim_imaging/header6.jpg" /></div>
</div>
</div>
<div class="col-10">
<img id="largeImage" src="https://thethemefoundry.com/wp-content/themes/ttf-reloaded/images/single-theme/video-thumbnail.png" class="img-fluid"/>
</div>
</div>
<script>
$('#thumbnails img').click(function(){
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
</script>
This http://jsfiddle.net/b6jtwndd/ code is working well for video. find this solution in stackoverflow.
javascript jquery css
javascript jquery css
edited Mar 4 at 1:44
Martijn Pieters♦
722k14125252334
722k14125252334
asked Dec 21 '18 at 11:07
shreya_jsshreya_js
4910
4910
What you mean? can you please explain?
– Just code
Dec 21 '18 at 11:24
in my slider, i want to embed youtube video as well. in above example, it,s work well for image . but in my slider i have some video as well. thanks
– shreya_js
Dec 21 '18 at 12:25
add a comment |
What you mean? can you please explain?
– Just code
Dec 21 '18 at 11:24
in my slider, i want to embed youtube video as well. in above example, it,s work well for image . but in my slider i have some video as well. thanks
– shreya_js
Dec 21 '18 at 12:25
What you mean? can you please explain?
– Just code
Dec 21 '18 at 11:24
What you mean? can you please explain?
– Just code
Dec 21 '18 at 11:24
in my slider, i want to embed youtube video as well. in above example, it,s work well for image . but in my slider i have some video as well. thanks
– shreya_js
Dec 21 '18 at 12:25
in my slider, i want to embed youtube video as well. in above example, it,s work well for image . but in my slider i have some video as well. thanks
– shreya_js
Dec 21 '18 at 12:25
add a comment |
1 Answer
1
active
oldest
votes
I add data-source within my img tag . and set the path of my video. and than did small changes in my function... now it's working for image and video as well.
$('#thumbnails img').click(function(){
video = '<iframe width="100%" height="515" src="'+ $(this).attr('data-video') +'"></iframe>';
if(this.hasAttribute('data-video'))
{
$('#largeImage').replaceWith(video);
}
else
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53883731%2fthumbnail-slider-display-video-and-images%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I add data-source within my img tag . and set the path of my video. and than did small changes in my function... now it's working for image and video as well.
$('#thumbnails img').click(function(){
video = '<iframe width="100%" height="515" src="'+ $(this).attr('data-video') +'"></iframe>';
if(this.hasAttribute('data-video'))
{
$('#largeImage').replaceWith(video);
}
else
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
add a comment |
I add data-source within my img tag . and set the path of my video. and than did small changes in my function... now it's working for image and video as well.
$('#thumbnails img').click(function(){
video = '<iframe width="100%" height="515" src="'+ $(this).attr('data-video') +'"></iframe>';
if(this.hasAttribute('data-video'))
{
$('#largeImage').replaceWith(video);
}
else
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
add a comment |
I add data-source within my img tag . and set the path of my video. and than did small changes in my function... now it's working for image and video as well.
$('#thumbnails img').click(function(){
video = '<iframe width="100%" height="515" src="'+ $(this).attr('data-video') +'"></iframe>';
if(this.hasAttribute('data-video'))
{
$('#largeImage').replaceWith(video);
}
else
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
I add data-source within my img tag . and set the path of my video. and than did small changes in my function... now it's working for image and video as well.
$('#thumbnails img').click(function(){
video = '<iframe width="100%" height="515" src="'+ $(this).attr('data-video') +'"></iframe>';
if(this.hasAttribute('data-video'))
{
$('#largeImage').replaceWith(video);
}
else
$('#largeImage').attr('src',$(this).attr('src').replace('thumb','large'));
$('#description').html($(this).attr('alt'));
});
answered Jan 2 at 12:14
shreya_jsshreya_js
4910
4910
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53883731%2fthumbnail-slider-display-video-and-images%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What you mean? can you please explain?
– Just code
Dec 21 '18 at 11:24
in my slider, i want to embed youtube video as well. in above example, it,s work well for image . but in my slider i have some video as well. thanks
– shreya_js
Dec 21 '18 at 12:25