Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

toggle div style problem.

Featured Replies

So i'm toggling a div from display = none to display = block.

 

The div that I am trying to change is being used for a horizontal jquery menu bar that scrolls the content in the div below it from left to right.

 

The problem that I am facing when changing the container div for all of this is that the div with all the content in doesn't display correctly when it is switched. instead of display the content div there is just a small white line. It still scrolls left and right but the first content div is now ontop of the other divs...for some reason.

  • Author

I've tried using Jquery but the same problem occurs. :(

 

Heres it when it's hidden using .hide, i've also set it to .show when portfolio is clicked.

 

http://www.alexjknight.com/ <Not working, click any of the tabls in portfolio to see.

 

Here it is without any Jquery/CSS hiding the div

 

http://www.alexjknight.com/working/ <working, content scrolls perfectly.

Edited by BITmixit

Give this a try

 

js/ajk.jquery.js

 

jQuery(document).ready(function($) {

$(".scroll").click(function(event){ 
 event.preventDefault();
 $('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
});
$(document).ready(function() {

   $('.full-width').horizontalNav({});

$('#porto').click(function() {
 $('#container').addClass("show");
});

});

 

add to css

 

#container{position:absolute;visibility:hidden;display:block;}
#container.show{position:relative;visibility:visible;}

  • Author

Give this a try

 

js/ajk.jquery.js

 

jQuery(document).ready(function($) {

$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
});
$(document).ready(function() {

$('.full-width').horizontalNav({});

$('#porto').click(function() {
$('#container').addClass("show");
});

});

 

add to css

 

#container{position:absolute;visibility:hidden;display:block;}
#container.show{position:relative;visibility:visible;}

 

This worked perfectly, cheers man and I learnt that you can add classes. Did not know this.

 

Is there a simple Jquery function to push the scroll bar down when expanding the height of the div for the portfolio as the scroll bar doesn't move.

This worked perfectly, cheers man and I learnt that you can add classes. Did not know this.

 

Is there a simple Jquery function to push the scroll bar down when expanding the height of the div for the portfolio as the scroll bar doesn't move.

 

Why not just plain Javascript ?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.