javascript - Make left side image sticky while right side scrolls with Wordpress and Waypoints -
i'm designing website wordpress , divi theme. there 2 column section image on left, , text on right. when image gets top of viewport, i'd image be 100% of viewport height , stick, while right side continues scroll until next section.
http://newbcs.bigcityswing.com/groupclasstest
here have far:
<script type="text/javascript"> (function($) { if ( $.fn.waypoint ) { var $waypoint_selector, $waypoint_selector = $('#top-section'), $site_header = $('#main-header'), $fixed_column = $('#stickysection .stickycolumn1'), $non_fixed_column = $('#stickysection .unstickycolumn2'), $offset = $site_header.height() + $waypoint_selector.height(); console.log($offset); $waypoint_selector.waypoint( { handler : function( direction ) { if ( direction === 'down' ) { $fixed_column.addclass( 'wpc-fixed-column' ); $non_fixed_column.addclass('wpc-non-fixed-column') console.log('down'); } else { $fixed_column.removeclass( 'wpc-fixed-column' ); $non_fixed_column.removeclass('wpc-non-fixed-column') console.log('up'); } }, offset: -$offset } ); } })(jquery)
and css:
.wpc-fixed-column { position: fixed; top: 0; } .unstickycolumn2.wpc-non-fixed-column { left: 33.333%; }
i can't happen, , when @ console in chrome, this: unable preventdefault inside passive event listener due target being treated passive. see https://www.chromestatus.com/features/5093566007214080
any appreciated.
thanks
css:
.stickycolumn1 { position: fixed; top: 0; left: 0; z-index: 1; } .unstickycolumn2 { width: 100%; padding-left: 33.4%; }
Comments
Post a Comment