I used jQuery shown here (https://stackoverflow.com/a/6967175/1130782) to get the links on my page to show/hide 3 different divs, as seen here: http://ikstudio.squarespace.com/lightfield/
I needed all of the divs to be hidden initially, so I removed the #showall function and added
jQuery('.targetDiv').hide();
to hide all the divs initially. Doing this broke the javascript gallery I am using inside of .
I am assuming that this is because the page loads with that div hidden and the gallery script can not properly position everything it needs to.
Is there anyway to resolve this?
Thanks
Can you not hide them with CSS?
.targetDiv {
display: none;
}
Related
I'm using Bootstrap 3 to make a responsive website. However, I'm making a "portfolio".
You can see the website here as well as my "error".
http://basic-models.com/b/
Scroll down to "Our models" and click on "Informations". When you click on that button, it will collapse a new element below the profile picture of a model.
But that collapsible element is pushing the picture below the element to right for one column.
I guess I don't have to place code here since you can just right click > source code it.
Also, this is my first question on Stack Overflow, so I'm sorry if it is not formatted properly. Thank you for all the help.
You can change the CSS position attribute of the collapsing div to absolute. That way, the element will float over the below item - but you`ll have to apply styles a bit.
Try it like that:
.model-outer div.collapse {
position: absolute;
z-index: 1000;
background-color: white;
width:100%;
left:0px;
margin-top:10px;
}
You see, positioning and styles are not that good, but I assume you can start from there.
Since you are already using Bootstrap, I would suggest you to use default bootstrap dropdown . The problem with current code is that the div which shows the information is not absolutely positioned. So, whenever that div is displayed, it takes up the extra space and breaks the layout of the grid. Bootstrap dropdown uses absolute positioned div and hence it doesn't break the layout. Try using it and it will definitely solve this issue.
I have a javascript method that runs, which hides certain parts of the screen, based on some values, which are sourced from a property in my MVC view model.
<body onload="TransferAmountDisplayToggle(#Model.EntityEventTypeId)">
When the screen loads, all controls are visible for around half a second, and then the controls hide, and the screen is ready.
Is there anyway to stop this from happening? i.e. Not show the screen until the javascript is complete?
You an hide the body with the visibility: hidden;
<body style="visibility:hidden;" onload="TransferAmountDisplayToggle(#Model.EntityEventTypeId)">
Then at the bottom of the TransferAmountDisplayToggle() JavaScript function, add:
$('body').css('visibility', 'visible');
Modifying display instead of visibility is an option, but I prefer to use visibility because sometimes there's JavaScript code that needs to check the width/height of elements and using display: none; can mess that up.
I have created a pop out sideBar. In that sideBar I have a accordion which contains divs. Those divs are draggable. The user can drag those divs and position them main page.
The problem that I am experiencing is that when the divs are dragged they are not visible outside the accordion. This can been seen in This video.
I can see that it is to do with the overflow being set to hidden however when I remove this the accordion content is shown when it should be hidden.
overflow: hidden;
JSFiddle to further show my problem.
How could I possibly fix this / what are possible ways to get around it.
Try adding this to your css
.accordion-heading + div.accordion-body {
position: static;
}
Is this what you are looking for? Updated fiddle http://jsfiddle.net/gNAFY/3/
If this solved your problem, it seems that inside bootstrap.css file, at line 5245, "position: relative" rule makes your divs not appearing outside the accordion. So you need to "reset" position to static.
For "el + el" css selector to work in IE8 and earlier, don't forget the <!DOCTYPE>.
I have a content slider on a page and I want to allow site visitors to print the contents of only the slide they click on. I have 7 slides and two of them have a button within the slide that says, "Print Contents". Each slide content is contained within it's own div.
I've successfully used a print specific style sheet before, but am not sure how to set varying print rules for one document. Is there some kind of JavaScript or jQuery I can apply? I am a novice with both but am willing to give anything a try.
Here is a similar question on SO but no answers; this one is close but I need to maintain CSS styles.
any help is appreciated. Thank you!
Set up a CSS rule for your main elements:
#media print {
div.main-element: display: none;
Then add another rule:
div.main-element.print-me: display: block;
Now you can add a "print" button to each section of content, and have a handler adjust the classes appropriately:
$('body').on('click', '.main-element button.print', function() {
$('.main-element').removeClass('print-me');
$(this).closest('.main-element').addClass('print-me');
window.print();
});
here it's the website: http://www.webkunst.comeze.com/test/
If you click on the left on artworks, it loads via ajax the page content (the items that appear on the right). The problem I have is that when I hover over the items, it does some kind of strange behavior, for example if I hover over the 4 to 9 items, it shows the hidden text but over the first three items, it's really strange.
This is how I do the effects:
To show the text, this is on my main js:
$(function(){
$(document).on("mouseover",".item",function(){
$(this).find(".art_title").fadeIn(200);
});
$(document).on("mouseleave",".item",function(){
$(this).find(".art_title").fadeOut(200);
});
});
To do the black transparent hover effect i'm using this tutorial :
http://tympanus.net/codrops/2011/11/02/original-hover-effects-with-css3/
Which uses css with .item .mask
and this is my markup:
What i'm doing wrong, why is doing that behavior?
I have to add that the effects works nice when the page it's not loaded via ajax.
Give your .item elements position:relative css.
Your absolute .art_title elements are aligning to the top of the page (instead of to the top of the .item