Class: Trip

Trip

new Trip(tripData, userOptions)

Trip

Parameters:
Name Type Description
tripData Array.<Object>
userOptions Object
Source:

Members

<static> this.settings :Object

It is used to keep user and default settings.

Type:
  • Object
Source:

Methods

<static> addAnimation(o)

Add animation on the trip block.

Parameters:
Name Type Description
o Object
Source:

<static> bindKeyEvents()

Bind keydown events on document.

Source:

<static> bindResizeEvents()

When users resize its browser, we will rerun Trip and restart the timer. TODO: We have to debounce this function later to make performance better.

Source:

<static> canGoNext() → {Boolean}

Check whether we can go to next trip or not.

Source:
Returns:

whether we can go to next trip

Type
Boolean

<static> canGoPrev() → {Boolean}

Check whether we can go to previous trip or not.

Source:
Returns:

whether we can go to previous trip

Type
Boolean

<static> cleanup()

Clean up all stuffs when we are going to start / restart a trip, so we can make we won't mess up with old stuffs.

Source:

<static> create()

This is a method wrapper.

Source:

<static> createOverlay()

This method is used to create overlay. If the overlay is in the DOM tree, we will not create it again.

Source:

<static> createTripBlock()

This method is used to create a trip block at the first time when start. If the trip block already exists on the DOM tree, we will not create it again.

Source:

<static> decreaseIndex()

We can call this method to decrease tripIndex because we are not allowed to manipualte the value directly.

Source:

<static> doLastOperation()

This is the last operation when we successfully finish all trips in the end.

Source:

<static> getCurrentTripObject() → {Object}

This method is used to get current trip data.

Source:
Returns:

current trip data

Type
Object

<static> getReplacedTripContent(content) → {String}

This method is used to replace all passed content with tripIndex and tripTotal information.

Parameters:
Name Type Description
content String
Source:
Returns:

replaced content

Type
String

<static> hasSpecialDirections(position) → {Boolean}

Check whether position is special or not

Parameters:
Name Type Description
position String

position

Source:
Returns:

whether position is speical direction or not

Type
Boolean

<static> hideExpose()

Make exposed element back to normal state and hide overlay.

Source:

<static> hideProgressBar()

Hide the progress bar and stop animations.

Source:

<static> hideTripBlock()

Hide the trip block.

Source:

<static> increaseIndex()

We can call this method to increase tripIndex because we are not allowed to manipualte the value directly.

Source:

<static> init()

Initialize Trip.

Source:

<static> isFirst() → {Boolean}

Check whether current trip is the first one.

Source:
Returns:

whether current trip is the first one

Type
Boolean

<static> isLast() → {Boolean}

Check whether current trip is the last one.

Source:
Returns:

whether current trip is the last one

Type
Boolean

<static> isTripDataValid(o) → {Boolean}

Check whether tripData is valid

Parameters:
Name Type Description
o Object

tripData

Source:
Returns:

whether tripData is valid

Type
Boolean

<static> keyEvent(e)

Bound keydown events. We will do specific actions when matched keys are pressed by user.

Parameters:
Name Type Description
e Event
Source:

<static> next(tripIndex)

next API, which will jump to next the trip.

Parameters:
Name Type Description
tripIndex Number
Source:

<static> pause()

pause API, which will pause the trip.

Source:

<static> pauseOrResume()

This is an wrapper for pause and resume API.

Source:

<static> pauseProgressBar()

Pause the progress bar.

Source:

<static> preInit()

This is used to preInit Trip.js. For current use, we will try to override this.console if there is no window.console like IE.

Source:

<static> prev()

prev API, which will jump to previous trip.

Source:

<static> removeAnimation()

Remove animation from the trip block.

Source:

<static> resume()

pause API, which will pause the trip.

Source:

<static> resumeProgressBar(remainingTime)

Resumse the progress bar.

Parameters:
Name Type Description
remainingTime Number
Source:

<static> run()

This is the main function to control each trip. In this method, we will make sure every tripData is valid and use that to do following works like showing trip, setup timer and trigger registered callbacks at the right timing.

Source:

<static> setTripBlock(o)

Based on current trip data, we will use this method to set all stuffs we want like content, prev / next labels, close button, used animations.

Parameters:
Name Type Description
o Object
Source:

<static> setTripBlockPosition(o, horizontalOrVertical)

This method is mainly used to help us position the trip block. As you can see, we will find out the $sel and its positions first then put our trip block at the right location.

Parameters:
Name Type Description
o Object
horizontalOrVertical String
Source:

<static> showCurrentTrip(o)

Show current trip. In this method, we will control all stuffs about current trip including animation, timer, expose, progress bar.

Parameters:
Name Type Description
o Object
Source:

<static> showExpose()

Expose element which has hasExpose property.

Source:

<static> showProgressBar(delay)

This is used to show progress bar UI. We will use jQuery to manipulate the animation.

Parameters:
Name Type Description
delay Number
Source:

<static> showTripBlock(o)

After we positioned our trip block, we have to show it on the screen. If the trip block is not on the screen, we will scroll the $root element and then make sure it is definitely on the screen.

Parameters:
Name Type Description
o Object
Source:

<static> start()

Start Trip.

Source:

<static> stop()

Stop API, which will stop the trip.

Source:

<static> unbindKeyEvents()

Remove keydown events from document.

Source:

<static> unbindResizeEvents()

Remove resize event from window.

Source:
DocStrap Copyright © 2012-2014 The contributors to the JSDoc3 and DocStrap projects.
Documentation generated by JSDoc 3.2.2 on Thu Jun 30th 2016 using the DocStrap template.