Widget:Slides: Difference between revisions

From Elwiki
mNo edit summary
mNo edit summary
Line 40: Line 40:
     position: relative;
     position: relative;
     float: left;
     float: left;
    width: 100%;
}
}
</style>
</style>
Line 60: Line 61:
             width = current.width();
             width = current.width();
         if(!current.is(':nth-last-child(2)')){
         if(!current.is(':nth-last-child(2)')){
             current.hide().next('.ss_content').fadeIn(500);
             current.hide().next('ss_content').fadeIn(500);
         }
         }
         else if(loop){
         else if(loop){
Line 66: Line 67:
         }
         }
     });
     });
     $('.ss_contents .ss_content:first-child').siblings().hide();
     $('.ss_content .ss_content:first-child').siblings().hide();
});
});
</script>
</script>

Revision as of 03:37, 25 September 2015

<style> .slideshow {

   position: relative;
   background-color: orange;
   overflow: hidden;

}

.slideshow .ss_nav {

   position: absolute;
   width: 100%;
   height: 100%;

}

.slideshow .ss_nav span {

   position: absolute;
   width: 50px;
   height: 50px;
   line-height: 50px;
   font-size: 50px;
   text-align: center;
   top: 50%;
   margin-top: -25px;
   z-index: 2;

}

.slideshow .ss_nav .ss_prev {

   left: 0;

}

.slideshow .ss_nav .ss_next {

   right: 0;

}

.slideshow .ss_contents {

   width: 100%;
   height: 100%;

}

.slideshow .ss_contents .ss_content {

   position: relative;
   float: left;
   width: 100%;

} </style> <script> $(function(){

   $('.ss_prev').click(function(){
       var loop = $(this).parent().parent().hasClass('loop'),
           current = $(this).parent().siblings('.ss_contents:first').children('.ss_content').not(':hidden'),
           width = current.width();
       if(!current.is(':first-child')){
           current.hide().prev('.ss_content').fadeIn(500);
       }
       else if(loop){
           current.hide().siblings('.ss_content:last-child').fadeIn(500);
       }
   });
   $('.ss_next').click(function(){
       var loop = $(this).parent().parent().hasClass('loop'),
           current = $(this).parent().siblings('.ss_contents:first').children('.ss_content').not(':hidden'),
           width = current.width();
       if(!current.is(':nth-last-child(2)')){
           current.hide().next('ss_content').fadeIn(500);
       }
       else if(loop){
           current.hide().siblings('.ss_content:first-child').fadeIn(500);
       }
   });
   $('.ss_content .ss_content:first-child').siblings().hide();

}); </script>