trying to get sly-js to scroll two separate divs simultaneously.

261 views
Skip to first unread message

lowm...@gmail.com

unread,
Jan 23, 2015, 8:59:23 AM1/23/15
to sly...@googlegroups.com
Hi,

Can I say that the Sly slider/scroller is just lovely, but I'm having a couple of issues trying to integrate it into a specific web page. Hopefully someone with better JS skills than my own might be able to assist.

The first issue is a bit of a deal breaker:

My web page currently uses a very small piece of javascript so that if one div is scrolled left/right, then a second div (directly underneath) scrolls left/right in unison with the top one. That JS is...

<script type="text/javascript">
var parentObject = "leader";
var childObject = "copycat";

$(document).ready(function()
{

var parent = "#" + parentObject;
var child = "#" + childObject;

$(parent).scroll(function () {

$(child).scrollLeft($(parent).scrollLeft());
$(child).scrollTop($(parent).scrollTop());

});
});
</script>

Now, the "leader" div is where Sly would be going. I can get Sly in place and get Sly working - but Sly needs the Div ID to be "basic" and if I amend the above code to make "leader" into "basic" Sly continues to work, but the duel scrolling of two divs is broken.

If I then amend var parentObject = "basic"; into var parentObject = "basic2"; and amend the div's ID to "basic2" then the duel scrolling works again - but Sly is broken.

I'm assuming the two are conflicting somehow, but don't understand where.

The second issue involves this horizontal slider being NOT item-based (it contains a single multi-column, single row table) and iOS 7 and 8. In these OS' Sly seems to be broken, whereas in iOS 6 it works as expected.

http://www.mjwebbassociates.com/temp/jir-wide-cat-2/sly-demo-martin.html

Thanks,
m.

Sly.js

unread,
Jan 23, 2015, 2:43:39 PM1/23/15
to sly...@googlegroups.com, lowm...@gmail.com
Use the Sly API to do whatever you need.


I suggest looking into 'move' and 'change'.

And here are Sly properties that hold the current state of Sly: https://github.com/darsain/sly/blob/master/docs/Properties.md

You are interested in 'pos' property that has the data about current Sly position.

How to bind event listeners and access properties is also all described in the documentation.
Reply all
Reply to author
Forward
0 new messages