bxSlider adds in an empty slide after deleting an image

Whenever I click a link in my navigation, I want to remove certain images from the page. I tried implementing a solution, but now I have two empty spaces where the images used to be. How can I remove those as well? I searched on Stack Overflow for a solution, but the suggestions there didn't fully work with my particular implementation.

Although I didn't include all the HTML code, I only included the relevant parts related to the bxslider on my webpage.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

   <script type="text/javascript">
$(document).ready(function() {
  $('.bxslider').bxSlider({
    speed: 1000,
    auto: true,
    autoControls: false,
    pager: false,
    autoHover: true,
    autoControlsCombine: true,
    pause: 5000,
    mode: 'fade'
  });
});

function nocontext(e) {
  var clickedTag = (e == null) ? event.srcElement.tagName : e.target.tagName;
  if (clickedTag == "IMG")
    return false;
}
document.oncontextmenu = nocontext;

   $(document).ready(function(){
      $(".nav").localScroll({duration:300});

      $(".cityskapes-link").click(function(){
        $(".animals").remove();
        $(".bxslider").reloadSlider();
      });
    });

  </script>
  <link href="css/jquery.bxslider.css" rel="stylesheet" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
  <link rel="stylesheet" href="css/photo.css">
  <title>Photography</title>
</head>

<body>
  <!-- Nav -->
  <div class="nav">
    <h1>TIRTH THE ARTIST PHOTOGRAPHY</h1>
    <ul id="nav-link-container">
  <li><a class="cityskapes-link" id = "nav-link">Cityskapes</a></li>
  <li><a class="animals-link" id = "nav-link">Animals</a></li>
  <li><a class="people-link" id = "nav-link">People</a></li>
  <li><a class="misc-link" id = "nav-link">Misc</a></li>
</ul>
  </div>

  <!-- Picture Slideshow -->
  <div id="slider">
    <ul class="bxslider">
      <li class="cityscapes"><img src="photos/NYC_Skyline_Revised.jpg"></li>
      <li class="cityscapes"><img src="photos/MinionDrawing-1.jpg"></li>
      <li class="animals"><img src="photos/NYC_Skyline_Daytime.jpg"></li>
      <li class="animals"><img src="photos/HeavenlySunrise-2.jpg"></li>
    </ul>
  </div>

Answer №1

Give this a shot:

let slideShow = $('.bx_slider').bxSlider({
    pager: false
});

$('.cityskapes-link').click(function() {
    $(this).parent().hide();
    slideShow.reloadSlider();
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing jQuery and AJAX, execute a PHP query based on the user's input and showcase the query's outcome without reloading the page

For the past 24 hours, I've been on a quest to find a solution. Although I've come across similar inquiries, either the responses are too complex for my specific scenario (resulting in confusion) or they are of poor quality. The crux of my issue ...

intervals should not be attached after being cleared by a condition

I am facing an issue with my slider that has a play button to change the slide image and a pause button. When I click on play, it functions as intended. However, when I pause and try to play again, it does not work. Although I clear the interval using th ...

Error Encountered: Unable to Locate 'bootstrap' label in Bootstrap 5 Popover

I have been working on implementing a popover in my Angular 12 project using Bootstrap version v5.0.1. However, I am encountering a name error that I can't seem to resolve: var exampleEl = document.getElementById(item.name + index); var tooltip = ne ...

What steps are involved in adding an image to an autocomplete script?

I need help adding an image to my autocomplete script. Below is my code that I'm struggling with. My Controller: function getsearch($c_id) { $searchTerm = $_GET['term']; $query = $this->db->query("SELECT state_name FROM state ...

Transferring information using "this.$router.push" in Vue.js

I'm currently developing a restaurant review project using Django REST and Vue.js. To ensure uniqueness, I have adopted Google Place ID as the primary key for my restaurants. The project also incorporates Google Place Autocomplete functionality. The ...

Displaying images in a React app using Node.js

I receive the image from the user as formdata Here is how I structured the Schema for the image The Image has been successfully stored in Monogodb This is my process of fetching image information using Axios I implement code for rendering the image on the ...

The anchor tag fails to trigger the onClick function in React

I'm having trouble updating the component state in my React app when clicking on an anchor tag within the render method. I've attempted to bind the function in the constructor, but the console.log statement is still not being called. Here's ...

Update the content of a div in place

I need to modify some text based on the position of a div element. A visual demonstration would be most helpful, so here's an animated gif showcasing what I hope to achieve: Below is the code that I am currently working with: https://jsfiddle.net/c0 ...

Manipulating and Parsing HTML files locally using Node.js

Hey there! I have a bit of an odd question that might be on the basic side. I'm diving into web development and front-end work, so I'm still fairly new to it all. The Scenario To give you some background, my experience with JS is mainly from usi ...

In Chrome browser, the orientation of the options in the datalist remains consistent

Is there a way to change the direction of the datalist's options to RTL? While I'm able to change the direction of the input element, the same doesn't apply to the options of the datalist. I've attempted setting the dir attribute to r ...

Can the outcome of a MySQL query be showcased in PHP without the need for looping?

Can I display the result of a MySQL query using an array index counter? I have a code that generates two tables for input numbers ranging from 6 to 11, dividing them equally if possible. It also generates team names incrementally (e.g., team 1, team2, ... ...

"Discover the magic of creating a navigation menu with jQuery toggle - let me show

Recently, I managed to create a side navigation using the target function in CSS3. However, I am curious about how I can achieve the same result using jQuery without disrupting the layout. Any assistance would be greatly appreciated. Here is the code sni ...

Having issues with the right margin in HTML5 canvas and struggling to remove the scroll bar

I am struggling with adjusting the margins of my canvas to ensure equal spacing on both sides without any horizontal scroll bars. Desired Outcome: Equal margin on both sides of canvas without any horizontal scroll bars. Issue: The margin-right property i ...

Using the columns property in CSS3 along with background-color

My ul-element has multiple lis with a background color assigned to it. I am using the CSS3 columns property and everything is working well, but the background color of my ul is only visible in the first column. What could be causing this issue? Thank you ...

Photoshop optimized webpage appearing distorted on Internet Explorer after saving for web

I designed a webpage using Photoshop, sliced it, saved it for the web, and uploaded the HTML file. It looks great in Firefox and Chrome, but Internet Explorer tells a different story. Does anyone know how to fix it and why there is this black padding? IE: ...

Creating a form that seamlessly integrates with the content using a combination

As I continue to explore the depths of WordPress and delve into learning HTML/CSS, my latest project involves embedding an email signup form on my website using Klaviyo. The basic code provided by their form creator initially had everything condensed into ...

How to automatically scroll to the most recently added element in an *ngFor loop using Angular 2

In my web page, I have a dynamic list rendered using an ngFor loop. Users can add or remove elements from this list by clicking on a button. What I want to achieve is to automatically scroll the browser view to the latest element added when a user clicks o ...

Stopping HTTP client calls in OnDestroy hook of an Angular Service

Is it possible to automatically unsubscribe from an http call in an Angular service using the ngOnDestroy hook? Just to note, I am already familiar with using the rxjs 'take' operator or manually unsubscribing from the service within the compone ...

Sending Three.js meshes to a web worker through JavaScript

I have a collection of objects, which are meshes generated using Three.js, that I need to perform operations on within a web worker. My question is, how can I send these objects to the worker? My understanding is that there's a concept called transfe ...

How can we use withStyles to customize the styling of a selected ListItem in ReactJS and Material UI?

I am seeking assistance in changing the style of a specific ListItem, similar to what is demonstrated in this Codesandbox. In the Codesandbox example, a global CSS stylesheet is utilized, but I prefer to implement the changes using the withStyle techniqu ...