iScroll in Wordpress

352 views
Skip to first unread message

Dave Campbell

unread,
Jul 15, 2011, 10:54:20 AM7/15/11
to isc...@googlegroups.com
Any problems using iScroll in Wordpress.I can get iScroll to work locally on my test files, however not when working with Wordpress.

Added the following to header.php

<head>

 <script src="iscroll.js" type="text/javascript"></script>
<script type="application/javascript" src="iscroll.js"></script>

<script type="text/javascript">
var myScroll;
function loaded() {
setTimeout(function () {
myScroll = new iScroll('wrapper', { hScrollbar: true, vScrollbar: true });
}, 100);
}
window.addEventListener('load', loaded, false);
</script>

Anyone see an issue? Thanks

Dave Campbell

unread,
Jul 18, 2011, 7:34:13 AM7/18/11
to isc...@googlegroups.com
I was using a child theme and the correct method is:
<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/iscroll.js"></script>


Richard

unread,
Jul 19, 2011, 8:46:09 AM7/19/11
to isc...@googlegroups.com
It worked fine for me to:

1. but a 
<div id="main"><div id="scroller"> ... </div></div><!--- main -->
 within the main-div


2. load the iScroll for the main-di: iScroll('main');

<!-- main -->
<script type="text/javascript">
myScroll = new iScroll('main');
</script>
 
the path to the js should be src="<?php bloginfo('template_url'); ?>/path/to/iscroll.js">
Reply all
Reply to author
Forward
0 new messages