lrsjng / jquery-fracs

jQuery plugin to determine the visible fractions of HTML elements.

Home Page:https://larsjung.de/jquery-fracs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Viewport Issues

naderhen opened this issue · comments

Hi,

I'm trying to use fracs on a collection of items with a custom viewport.

I successfully set the rectangle property using :

var Rect = jQuery.fracs.rect('#yir_content');

But I get an error when trying to execute:

var Fracs = jQuery.fracs.fracs('.month_container', Rect);

The error reads:

Uncaught TypeError: Object .month_container has no method 'intersection'

Could the fact that the '.month_container's are not direct descendants of the #yir_content element be causing the issue?

Any help would be greatly appreciated. Thanks!

The first argument of method fracs has to be an HTMLElement

http://larsjung.de/fracs/#def-static-fracs

You are giving it a String. Try to replace '.month_container' with something like $('.month_container').get(0)

I've tried instantiated with a number of different options for the selector and still get the following errors:

$('.month_container').get(0) => Uncaught TypeError: Object # has no method 'intersection'
$('.month_container').eq(0) => Uncaught TypeError: Object [object Object] has no method 'intersection'
$('#month_2_2011') => Uncaught TypeError: Object [object Object] has no method 'intersection'

In the upcoming release 0.11 it will be possible to get the fractions via $(element).fracs(viewportElement).

For your example: var fracs = $('.month_container').fracs($('#yir_content')).