Create a Custom Image Gallery With a Horizontal Thumbnail Carousel Simply using Custom JQuery Small Function and CSS for Create Image Gallery | Create multiple image slider in jquery

1,214 views

Hey guys, today in this post we are going to learn about Create a Custom Image Gallery With a Horizontal Thumbnail Carousel Simply using Custom JQuery Small Function and CSS for Create Image Gallery.

Files we used in this post example:-

imageGallerySlider.html HTML File It is used for Create a Custom Image Gallery With a Horizontal Thumbnail Carousel.

imageGalleryFunction.js

JavaScript File It is holding JavaScript click functionality for Show/Hide and Rotate the Image Gallery Slider.

imageGalleryStyle.css

Style CSS File It is used for Image Gallery Slider Alignment.

jquery-1.7.1.min.js

JQuery Library Min File It is a JQuey Library that is provided by JQuery.

Final Output

Custom Image Gallery With a Horizontal Thumbnail Carousel -- w3web.net

 

You can download file directly from github by Click Here.

Challenges in your career

๐ŸŽฏ If You Are Facing Any Of These 6 Challenges in your career.

  • Learn Salesforce Development
  • Career Confusion
  • No Interview Call
  • Low Salary
  • No Promotion/Growth
  • No Finding New Job Opportunity
  • Why you stucking from past so many years in same company?

 

 
 

Other related post that would you like to learn in Salesforce

 

Download Supported jQuery Library for Custom Banner Rotating Image with Text Slider.

Step 1:- Create HTML File : imageGallerySlider.html

imageGallerySlider.html [HTML File]


  1.   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <script type="text/javascript" src="http://w3web.net/wp-includes/js/jquery-1.7.1.min.js"></script>
  7. <link href="include/imageGalleryStyle.css" rel="stylesheet" type="text/css" />
  8. <script type="text/javascript" src="include/imageGalleryFunction.js"></script>
  9.  
  10.  
  11. </head>
  12.  
  13. <body>
  14. <div class="galeryMain">
  15.    <div class="glrlyImgZoom">
  16.       <div class="zoomItem" id="0"><img src="https://www.w3web.net/wp-content/uploads/2020/10/lwc-lookupContactFiture.png" width="500" height="335" alt="" /></div>
  17.       <div class="zoomItem" id="1"><img src="https://www.w3web.net/wp-content/uploads/2020/10/bannerRotateSlideFeature.png" width="500" height="335" alt="" /></div>
  18.       <div class="zoomItem" id="2"><img src="https://www.w3web.net/wp-content/uploads/2020/09/lwcSearchAccount.png" width="500" height="335" alt="" /></div>
  19.       <div class="zoomItem" id="3"><img src="https://www.w3web.net/wp-content/uploads/2020/09/lwcModalPopupFeature.png" width="500" height="335" alt="" /></div>
  20.       <div class="zoomItem" id="4"><img src="https://www.w3web.net/wp-content/uploads/2020/09/insertContactFeatute-lwc.png" width="500" height="335" alt="" /></div>
  21.       <div class="zoomItem" id="5"><img src="https://www.w3web.net/wp-content/uploads/2020/09/insertAccountLwc.png" width="500" height="335" alt="" /></div>
  22.       <div class="zoomItem" id="6"><img src="https://www.w3web.net/wp-content/uploads/2020/09/avoidDuplicateWithApex.png" width="500" height="335" alt="" /></div>
  23.       <div class="zoomItem" id="7"><img src="https://www.w3web.net/wp-content/uploads/2020/09/lastModifiedDate.png" width="500" height="335" alt="" /></div>
  24.       <div class="zoomItem" id="8"><img src="https://www.w3web.net/wp-content/uploads/2020/09/pillFeatureImg.png" width="500" height="335" alt="" /></div>
  25.       <div class="zoomItem" id="9"><img src="https://www.w3web.net/wp-content/uploads/2020/09/eventApplicationLightning.png" width="500" height="335" alt="" /></div>      
  26.     </div>
  27.  
  28.    <div class="thumbImgMain">
  29.      <div class="autoHide">
  30.       <span class="pre"><a href="#"><img src="images/lft-arrow.gif" width="10" height="35" alt="" /></a></span> 
  31.       <ul class="thumbList">
  32.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/10/lwc-lookupContactFiture.png" width="75" height="50" alt="" /></a></li>
  33.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/10/bannerRotateSlideFeature.png" width="75" height="50" alt="" /></a></li>
  34.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/lwcSearchAccount.png" width="75" height="50" alt="" /></a></li>
  35.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/lwcModalPopupFeature.png" width="75" height="50" alt="" /></a></li>
  36.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/insertContactFeatute-lwc.png" width="75" height="50" alt="" /></a></li>
  37.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/insertAccountLwc.png" width="75" height="50" alt="" /></a></li>
  38.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/avoidDuplicateWithApex.png" width="75" height="50" alt="" /></a></li>
  39.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/lastModifiedDate.png" width="75" height="50" alt="" /></a></li>
  40.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/pillFeatureImg.png" width="75" height="50" alt="" /></a></li>
  41.         <li><a href="#"><img src="https://www.w3web.net/wp-content/uploads/2020/09/eventApplicationLightning.png" width="75" height="50" alt="" /></a></li>                
  42.      </ul>
  43.       <span class="nxt"><a href="#"><img src="images/rt-arrow.gif" width="10" height="35" alt="" /></a></span> 
  44.      </div>
  45.   </div>
  46.  </div>
  47.  
  48.  <br/>
  49.    <!--Start RelatedTopics Section-->
  50. <div style="border:1px #ddd solid; padding:10px; background:#eee; margin:40px 0;">
  51.  
  52.             <p data-aura-rendered-by="435:0"><img src="https://www.w3web.net/wp-content/uploads/2021/05/thumbsUpLike.png" width="25" height="25" style="vertical-align:top; margin-right:10px;" data-aura-rendered-by="436:0"><strong data-aura-rendered-by="437:0"><span style="font-size:16px; font-style:italic; display:inline-block; margin-right:5px;">Don't forget to check out:-</span><a href="https://www.w3web.net/" target="_blank" rel="noopener noreferrer" style="text-decoration:none;" data-aura-rendered-by="440:0">An easy way to learn step-by-step online free Salesforce tutorial, To know more Click  <span style="color:#ff8000; font-size:18px;" data-aura-rendered-by="442:0">Here..</span></a></strong></p>
  53.  
  54.             <br/><br/>
  55.             <p data-aura-rendered-by="435:0"><img src="https://www.w3web.net/wp-content/uploads/2021/07/tickMarkIcon.png" width="25" height="25" style="vertical-align:top; margin-right:10px;" data-aura-rendered-by="436:0"><strong data-aura-rendered-by="437:0"><span style="font-size:17px; font-style:italic; display:inline-block; margin-right:5px; color:rgb(255 128 0);">You May Also Like โ†’</span> </strong></p>
  56.             <div style="display:block; overflow:hidden;"> 
  57.                 <div style="width: 50%; float:left; display:inline-block">
  58.                     <ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;"> 
  59.                         <li><a href="https://www.w3web.net/lwc-get-set-lightning-checkbox-value/" target="_blank" rel="noopener noreferrer">How to get selected checkbox value in lwc</a></li>
  60.                         <li><a href="https://www.w3web.net/display-account-related-contacts-in-lwc/" target="_blank" rel="noopener noreferrer">how to display account related contacts based on AccountId in lwc</a></li>
  61.                         <li><a href="https://www.w3web.net/create-lightning-datatable-row-actions-in-lwc/" target="_blank" rel="noopener noreferrer">how to create lightning datatable row actions in lwc</a></li>
  62.                         <li><a href="https://www.w3web.net/if-and-else-condition-in-lwc/" target="_blank" rel="noopener noreferrer">how to use if and else condition in lwc</a></li>
  63.                         <li><a href="https://www.w3web.net/get-selected-radio-button-value-and-checked-default-in-lwc/" target="_blank" rel="noopener noreferrer">how to display selected radio button value in lwc</a></li>
  64.                     </ul>
  65.             </div>
  66.  
  67.             <div style="width: 50%; float:left; display:inline-block">
  68.                     <ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;"> 
  69.                         <li><a href="https://www.w3web.net/display-account-related-contacts-lwc/" target="_blank" rel="noopener noreferrer">display account related contacts based on account name in lwc</a></li>
  70.                         <li><a href="https://www.w3web.net/create-lightning-datatable-row-actions-in-lwc/" target="_blank" rel="noopener noreferrer">how to insert a record of account Using apex class in LWC</a></li>
  71.                         <li><a href="https://www.w3web.net/fetch-picklist-values-dynamic-in-lwc/" target="_blank" rel="noopener noreferrer">how to get picklist values dynamically in lwc</a></li>
  72.                         <li><a href="https://www.w3web.net/edit-save-and-remove-rows-dynamically-in-lightning-component/" target="_blank" rel="noopener noreferrer">how to edit/save row dynamically in lightning component</a></li>
  73.                         <li><a href="https://www.w3web.net/update-parent-object-from-child/" target="_blank" rel="noopener noreferrer">update parent field from child using apex trigger</a></li>
  74.                     </ul>
  75.                 </div>
  76.                <div style="clear:both;"></div> 
  77.                <br/>
  78.                 <div class="youtubeIcon">
  79.                     <a href="https://www.youtube.com/channel/UCW62gTen2zniILj9xE6LmOg" target="_blank" rel="noopener noreferrer"><img src="https://www.w3web.net/wp-content/uploads/2021/11/youtubeIcon.png" width="25" height="25" style="vertical-align:top; margin-right:10px;"/> <strong>TechW3web:-</strong> To know more, Use this <span style="color: #ff8000; font-weight: bold;">Link</span> </a>
  80.                 </div>
  81.     </div>
  82.  
  83. </div>
  84.  
  85.   <!--End RelatedTopics Section-->
  86.  
  87. </body>
  88. </html>

Step 2:- Create JavaScript File : imageGalleryFunction.js

imageGalleryFunction.js [JavaScript File]


  1.   $(document).ready(function(){
  2. 	$('.galeryMain').glerySlide();
  3.  
  4. })
  5.  
  6. $.fn.glerySlide = function()
  7. {
  8. 	var thisObj = $(this);
  9. 	var ul = thisObj.find('ul:first');
  10. 	var size = thisObj.find('li').size();
  11. 	var liwidth = thisObj.find('li').outerWidth(true);	
  12.  
  13. 	ul.width(size*liwidth);
  14.  
  15. 	thisObj.find('li:first').find('a:first').addClass('active');
  16. 	var animation = true;
  17.  
  18. 	var backSize = '-' + liwidth*6 + 'px';
  19.  
  20.  
  21. 	$('.nxt a').click(function(){							   
  22. 		var x1 = $("ul.thumbList li a:eq("+i+")")				   
  23. 		if(!$(this).is('.active'))
  24. 		{
  25. 			if(animation)
  26. 			{
  27. 			  $('ul.thumbList').animate({left:'-=' + liwidth+'px'}, 100, function(){
  28. 				  autoPlay();	
  29. 				});				
  30. 			}
  31. 		}
  32. 		return false;
  33. 	})
  34.  
  35.  
  36. 	$('.pre a').click(function(){
  37. 		if(!$(this).is('.active'))
  38. 		{
  39. 			if(animation)
  40. 			{
  41. 				$('ul.thumbList').animate({left:'+=' + liwidth+'px'}, 100, function(){
  42. 					autoPlay();																 
  43. 				})
  44. 			}
  45. 		}
  46. 		return false;		
  47. 	})
  48.  
  49.  
  50.  function autoPlay()
  51.  {
  52. 	 animation = true;
  53. 	 if($(ul).css('left')=='0px')
  54. 	 {
  55. 		 $('.nxt a').removeClass('active');
  56. 		 $('.pre a').addClass('active'); 
  57. 	 }
  58.  
  59. 	 else if($(ul).css('left')==('-' + liwidth*(size-6) + 'px'))
  60. 	 {
  61. 		 $('.pre a').removeClass('active');
  62. 		 $('.nxt a').addClass('active');		 	
  63. 	 }
  64. 	 else
  65. 	 {
  66. 		 $('.nxt a').removeClass('active');
  67. 		 $('.pre a').removeClass('active');
  68. 	 }
  69.  }
  70.  
  71.  
  72.  
  73. $('ul.thumbList li a').each(function(i){
  74. 	$(this).attr('rel', i);								 
  75.  })
  76.  
  77.  
  78.  
  79. $('.pre a').addClass('active');
  80. $('.zoomItem').not(':first').hide();
  81.  
  82. $('ul.thumbList li a').click(function(){
  83.  
  84. 	$('.zoomItem').hide();
  85. 	$('#' + this.rel).show();	
  86.  
  87. 	$('ul.thumbList li a').removeClass('active');
  88. 	$(this).addClass('active');
  89.  })
  90.  
  91.       var i=0;
  92. 	  function autoPlaySlide()
  93. 	    {
  94. 		  i++;
  95. 		  if($('zoomItem:last').css('display')=='block')
  96. 		  {
  97. 			 i=0;
  98. 		  }
  99. 		  else if(i > 5)
  100. 		  {
  101. 		    $('ul.thumbList').animate({left:backSize}, 100);						 
  102. 		  }
  103.  
  104. 		   if($('.zoomItem:last').css('display')=='block')
  105. 			 {
  106. 				$('ul.thumbList').animate({left: '0'}, 100); 
  107. 				i=0;
  108. 			 }
  109.  
  110.  
  111.  
  112. 		  $('.pre a').removeClass('active');
  113.           $("ul.thumbList li a").removeClass('active');
  114. 		  $("ul.thumbList li a:eq("+i+")").addClass('active');		  
  115.  
  116. 		  $('.zoomItem').fadeOut();		  
  117. 		  $('#' + i).fadeIn();		  
  118. 		}		
  119.  
  120. 	 var setTimespan =  setInterval(function(){autoPlaySlide()}, 3000);
  121.  
  122.  
  123.   $('.pre a, .nxt a, ul.thumbList li a img').hover(function(){
  124. 		clearInterval(setTimespan);							 
  125. 	}, function(){
  126. 		setTimespan =  setInterval(function(){autoPlaySlide()}, 3000);
  127. 	 })
  128.  
  129.  
  130. }
  131.  // JavaScript Document

Step 3:- Create Style CSS : imageGalleryStyle.css

imageGalleryStyle.css [Style CSS File]


  1.         .galeryMain{ width:500px; margin:auto;}
  2. 	.glrlyImgZoom{ width:500px;  height:335px; border:2px #666 solid; margin-bottom:10px; position:relative;}
  3. 	.zoomItem{ position:absolute; left:0; top:0;}
  4. 	.thumbImgMain{ position:relative;}
  5. 	.autoHide{ width:500px; overflow:hidden;}
  6. 	ul.thumbList{ margin:0; padding:0; list-style:none; position:relative;}
  7. 	ul.thumbList li{ width:75px; float:left; margin-right:9px;}
  8. 	ul.thumbList li a img{ border:2px #666 solid;}
  9. 	ul.thumbList li a:hover img, ul.thumbList li a.active img{ border:2px #ff0000 solid;}
  10.  
  11. 	.pre{ width:10px; position:absolute; left:-20px; top:10px;}
  12. 	.pre a.active img{opacity:0.5;}
  13. 	.nxt{ width:10px; position:absolute; right:-20px; top:10px;}
  14. 	.nxt a.active img{opacity:0.5;}

Custom Image Gallery With a Horizontal Thumbnail Carousel -- w3web.net

 

Further post that would you like to learn in Salesforce

 

 

 

FAQ (Frequently Asked Questions)

What is jQuery image slider?

The jQuery image slider contains images that run them using the previous and next icons.

How do I connect JavaScript to HTML?

o include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the 'head' tags in your HTML document.

Where do I write JavaScript code?

JavaScript provides 3 places to put the JavaScript code: within body tag, within head tag and external JavaScript file.

Related Topics | You May Also Like

 
  

Our Free Courses โ†’

๐Ÿ‘‰ Get Free Course โ†’

๐Ÿ“Œ Salesforce Administrators

๐Ÿ“Œ Salesforce Lightning Flow Builder

๐Ÿ“Œ Salesforce Record Trigger Flow Builder

๐Ÿ‘‰ Get Free Course โ†’

๐Ÿ“Œ Aura Lightning Framework

๐Ÿ“Œ Lightning Web Component (LWC)

๐Ÿ“Œ Rest APIs Integration



Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Leave a Comment