Created
January 18, 2012 16:32
-
-
Save gavinblair/1633888 to your computer and use it in GitHub Desktop.
jScrollPane on an element with no children
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<div id="scrollme"> | |
lots of content here, but no child elements. Muffin caramels danish cotton candy carrot cake icing tiramisu ice cream candy canes. Jelly-o marshmallow toffee brownie halvah bear claw jelly-o bear claw. Dessert chupa chups ice cream sugar plum fruitcake marshmallow. Apple pie lemon drops biscuit sweet powder gingerbread. Wafer dragée tiramisu. Candy canes chocolate pudding cupcake chocolate cake biscuit jelly-o. Cookie muffin halvah jelly beans candy chupa chups. Topping danish tart. Donut oat cake toffee. Icing soufflé candy cotton candy jelly. Cake gingerbread powder. Danish applicake jelly cotton candy cheesecake. | |
Apple pie chocolate bar sugar plum gummies brownie wafer pastry gingerbread chocolate. Pudding liquorice toffee wafer apple pie jelly soufflé. Candy pastry bonbon marshmallow gingerbread candy canes cake sweet roll muffin. Bonbon icing faworki cotton candy dragée jelly. Chocolate jelly jujubes soufflé marshmallow bonbon tiramisu jelly beans. Jujubes macaroon jelly beans sweet roll cheesecake brownie brownie. Jelly-o cookie tart. Gummies macaroon bonbon ice cream lollipop jelly pudding powder. Sugar plum sesame snaps chocolate cake gummies biscuit topping ice cream tart bear claw. Jelly beans marzipan cookie sesame snaps faworki caramels gummi bears. Caramels caramels ice cream sugar plum fruitcake carrot cake bear claw. Jelly-o carrot cake chocolate cake fruitcake marzipan. Pie danish carrot cake candy donut chocolate cake bear claw jujubes caramels. Cake dragée jelly beans chocolate. | |
</div> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
//jScrollPane requires a wrapping child. rather than make our html look ugly, | |
//let's add the child using jQuery's wrapInner() function | |
if($("#scrollme").children().length == 0) { | |
$("#scrollme").wrapInner("<div />"); | |
} | |
$('#scrollme').jScrollPane(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://api.jquery.com/wrapInner/
http://jscrollpane.kelvinluck.com/