thumbnail slider display video and images












0















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.










share|improve this question

























  • 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
















0















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.










share|improve this question

























  • 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














0












0








0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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












1 Answer
1






active

oldest

votes


















0














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'));
});





share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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'));
    });





    share|improve this answer




























      0














      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'));
      });





      share|improve this answer


























        0












        0








        0







        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'));
        });





        share|improve this answer













        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'));
        });






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 2 at 12:14









        shreya_jsshreya_js

        4910




        4910
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith