Git Product home page Git Product logo

cabin-jquery's Introduction

jQuery Filtering && Pagination

In this repository, you will practice implementing a filtering system on a set of DOM attributes.

You will use click handlers, data-attributes, and whatever other means possible to filter cabins based on their price. Editing the HTML is fair game for this exercise.

Screen Shot

Iteration Zero | Poking Around

  • Add three new cabins to the listing. Each cabin should have a price and follow the naming structure and patterns that are currently present.
  • Add these cabins at the end of the listing.
  • You can find creative commons images here
  • Implement a feature which will toggle the background image on the body attribute. When clicking the dark-wood circle, it should add the dark_wood.png as the background image. When clicking the lighter wood circle, it should add the tileable_wood_texture.png back as the background image.
  • Add a new option to the background toggle that changes the background to the forest.jpg image. The circle should appear to the right of the dark button, and should follow the same patterns/styles as the other two buttons.
  • When the forest image is being applied, also apply background-size: cover so that the image does not stretch. The background-size: cover should only be applied when the forest is set as the background.

Iteration One | Sorting

  • Implement a toggle feature which will sort the cabins from high to low and vice versa.
  • When clicking the Low link, sort the cabins from low to high.
  • When clicking the High link, sort the cabins from high to low. - When clicking these links, the url should not have /# in the url. See preventDefault. - The html method may be useful here.

Iteration Two | Showing One Price Range

  • When clicking a price range from the sidebar, show only the images that fall within that price range; or hide those that are not within that filter. For now, only worry about having one filter clicked at a time.
  • Your sorting functionality should still work!
  • When building this feature, think of what it would take to add a new price range filter. Would you have to add more code to handle prices from 1Mil - 2Mil? Could we build an object that would help us here?

Iteration Three | Filtering For Multiple Price Ranges

  • Now, when multiple filters are clicked, show cabins that fall within all clicked filters.
  • If 0-50k && 500k - 1Mil are clicked, it should show all homes between 0-50k and all homes between 500k - 1mil
  • Change one of your homes to have a price of $1,500,000 dollars, and add a new filter for 1Mil - 2Mil. Does your code still work? Did you have to add anything to your javascript file?
  • Before moving forward, see if you can write your script so that you could add any number of filters in the HTML, and not have to change your javascript.

Iteration Four | Stretch Goal: Pagination

  • Update the HTML so that all the cabins fall within the same price range. Next, implement a pagination feature which only displays 6 cabins at a time. Users must click a "Next Page" button to see the next 6 images. Your filtering functionality should still work.

Useful Snippets

  • Use $("input:checked")) to select all checkboxes that are currently selected.
  • It may be helpful to build an object which maps houses to their respective price category. This may be similar to the Historical Life Expectancy Exercise
  • You can also select attributes based on their input values, $("input[value='onebilliondollarz']")
  • The attr method can both get and set attribute values. $(this).attr("data-price")

Image attribution can be found in images.md

cabin-jquery's People

Contributors

daharris avatar deitrick avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.