Hello,
I’m learning jQuery. I use this template : http://www.youxithemes.com/themes/leviate and I made changes. The problem is
$( 'body' ).scrollspy( 'refresh' );
And I empty the div ”# containercrea” to click the “zw-nav” menu :
Everything works, except that the values of the scroll #anchors are lost since the insertion of the contents of the div "#containercrea"changes the height of the page so the positioning div index.html the menu with anchors therefore does not work properly, it is lost ! I tried to do a refresh of the body:
I also tried
$( 'body' ).scrollTo( 'refresh' );
If it helps, here are the pieces of script with the word "scroll" that I found in the js used by the template (leviate.js).
- /* ==========================================================================
- ScrollSpy
- ============================================================================= */
- if( $.fn.scrollspy ) {
- $( 'body' ).scrollspy({
- target: '#zw-header'
- });
- $( window ).on( 'smartresize orientationchange', function() {
- $( 'body' ).scrollspy( 'refresh' );
- });
- }
- /* ==========================================================================
- ScrollTo
- ============================================================================= */
- if( $.fn.scrollTo ) {
- $( '#zw-nav, #work, #zw-header .brand, .slider-block .slide-link' ).on( 'click', 'a[href^="#"]', function(e) {
- var href = $( this ).attr( 'href' );
- var target = href === '#'? 0 : $( href );
- $( window ).scrollTo( target, {
- duration: $.isHandheld? 0 : 400
- });
- e.preventDefault();
- });
- }
Thank you kindly help me.
Mo