Using jQuery for slide shows in Ruby on Rails framework

I'm attempting to create a slideshow using jQuery and have the images stored in an array. However, I'm struggling with the implementation of the slideshow functionality. I've checked out 'http://jquery.malsup.com/cycle/' for guidance, but I'm still unsure about the process.

Also, in the views>layouts>application section

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.72.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('#shuffle').cycle({ 
    fx:     'shuffle', 
    delay:  -4000 
});
});

To display the photos individually:

    <div id="shuffle">
    <% @building.building_photos.each do |photo| %>
      <%= link_to (image_tag (photo.photo.url)), @building %>
    <% end %>

  </div>

UPDATE 1(source code)

<!DOCTYPE html>
<html>
<head>
  <title>Welcome to koshbay</title>
  <link href="/assets/all.css" media="screen" rel="stylesheet" type="text/css" />
  <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
  <link href="/assets/about.css?body=1" media="all" rel="stylesheet" type="text/css" />
  <link href="/assets/addphotos.css?body=1" media="all" rel="stylesheet" type="text/css" />
  <link href="/assets/admin.css?body=1" media="all" rel="stylesheet" type="text/css" />
  <link href="/assets/buildings.css?body=1" media="all" rel="stylesheet" type="text/css" />
  <link href="/assets/contact.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/forrent.css?body=1" media="all" rel="stylesheet" type="text/css" />
...

If you have any suggestions on how I can achieve this task (as it's my first time working with jQuery), please share your insights.

Answer №1

To begin, make sure to insert the missing }); for properly closing your document ready

Then, you have two options: either delete easing: 'easeOutBack' from your cycle plugin call,

or include the easing library by visiting this link: here

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

Ways to implement a custom scrollbar across an entire webpage:

I am trying to implement the Jquery custom content scroller on my webpage to replace the default scrollbar. However, I am facing difficulties in getting it to work properly. You can view my code on Codepen. Although the plugin works fine with smaller blo ...

What causes the button's frame color to change when I click on it?

I am facing an issue with a button I created. When I click the button, the frame color changes and I cannot figure out why. I have attached images showing the button before and after it is clicked. Before: https://i.sstatic.net/5jpB1.png After: https://i ...

The content is overflowing outside the boundaries of the div, yet there is no

I am currently utilizing jQuery to dynamically load the content of a text file into a div element. However, when the content exceeds the dimensions of the div, no scroll bar is displayed. Here is the HTML structure: <!DOCTYPE html> <html lang=" ...

What are some common reasons why CSS and Bootstrap code can unexpectedly break?

I have been working on two tabs (tab-one, tab-two) where one is visible and the other is hidden. However, there has been an issue where the code breaks between the bottom of tab-one and the top of tab-two, causing some portion of tab-two to be occasionally ...

A step-by-step guide on making an animation series with html and css keyframes

I've been working on creating a captivating animation using HTML and CSS keyframes, but I seem to have hit a roadblock. Despite trying different rotations and transforms, I can't seem to achieve the desired effect depicted in the image below. The ...

What is the best way to align an element based on the position of another element?

I have integrated a calendar icon above a fullcalendar, and when I click on the icon, a react-datepicker pops up. Here is my CSS : .react-datepicker { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.8rem; background-color: ...

Interested in integrating server side JavaScript with your Android application?

Running a simple web page on a Raspberry Pi to toggle the board's LED with the click of a button. The button triggers a JavaScript function that controls the LED. Now, I want to be able to call this script from a button in an Android application... B ...

The deletion of an item from the database was unsuccessful when attempting to do so through an AJAX

Struggling with an issue that's leaving me stumped - I just want to delete an uploaded file from the database, but I can't seem to make it work. My hunch is that my delete_shop_item.php script isn't functioning properly or that the loop in ...

AngularJS: Issue with JQuery Slider not Updating Scope Value

I am currently working on a project using AngularJS and I have integrated a jQuery slider into it. However, I am facing an issue where I need to change the value of a select box which is defined in a $scope array, but the functionality is not working as ex ...

AJAX Post Request Function without Form That Does Not Reset

I am currently struggling with understanding the Ajax POST method. I am attempting to make an API request, and since the response has similar parameters, I decided to create a global function that can be used by other HTML/JS pages. However, I am aware tha ...

How can I remove the gaps between Bootstrap panels on a website?

The Issue https://i.stack.imgur.com/I5EFR.png My problem is with the spacing between the panels, highlighted in red. I've attempted to remove them by using the following CSS: .panel { margin-top: 0; margin-bottom: 0; padding-top: 0; ...

Change the color of the text in a shiny dashboard

While exploring shiny dashboard, I came across this link that explains how to modify colors in the sidebar and header. However, I'm struggling to change the font color for sidebar items. The default white font color becomes unreadable when using light ...

Inserting a border both above and below an element may result in the parent overflowing

I am facing an issue similar to the following: div.parent { height: 100px; padding: 20px; box-sizing: border-box; overflow: auto; } div.parent div.thing { height: 20px; width: 90%; border: 1px solid black; } <div class="parent"> ...

Loading additional content and executing queries using Ajax in WordPress

My attempt at adding a "load more" button to display posts is almost ideal, except for one issue. Every time I click on the button for the third time, it repeats the same three posts. For instance, if my posts are labeled t10 to t1, when I first load mor ...

What is the reason for the successful addition of a list item, using dynamic methods, in Chrome and Firefox while encountering issues in

I have encountered an issue with my jQuery code that works perfectly fine in Firefox and Chrome but fails to work in Internet Explorer 8 (I haven't tested it on other versions of IE). It is important to note that Internet Explorer is running in standa ...

Using jQuery sortable to update a hidden field with image IDs following a sorting activity

Below is the HTML code snippet that I am working with: <section class="layers-multi-image-container layers-has-multi-image"> <ul class="layers-multi-image-list multi-image-list layers-sortable ui-sortable"> <!-- Image --> <li> ...

Choose a tag in order to connect to a different page when an event occurs in Rails

Working on my first complete stack rails application! I am trying to implement a select dropdown menu that will direct users to a specific show page within the app. Each option represents a different college with its own individual show page. I am struggl ...

Why am I receiving a null response from my ajax request?

I have a working ajax call to fetch XML data from my REST API. However, when I try to echo the results, JQuery returns null. If I use var_dump on the results instead, JQuery accepts the information but it's not formatted correctly and causes errors. ...

Styling tricks for rotating carousel images using CSS animations

I'm currently working on a carousel component that functions without the use of JavaScript. While I have made significant progress towards my goal, I am facing challenges with the animation itself. The desired behavior is for the slides to animate o ...

Creating a JavaScript function that responds to multiple click events

Can someone please help me out? I have the link to the output of my work below using JavaScript and HTML: My goal is for only one circle to be active when clicked, while the others are disabled. Currently, when I click on a circle and then another one, bo ...