I’m making a website (using WordPress), and I inserted two bars by the side on my slider. The problem is: when the page is too small, the two bars are going over and under the slider. I would like to just make them disappear when the browser page in smaller than 1220px.
Here is the code of my slider (and the two bars). It is located in my Header.php file:
<div style="text-align: center; margin-bottom:20px;">
<div id="bar" style="height:420px; width:6px; display:inline-block;">
<img src="http://e404.ca/wp-content/uploads/SliderBar.png">
</div>
<div style="margin-left:auto; margin-right:auto; height:420px; width:1200px; display:inline-block;">
<?php layerslider(1, 'homepage'); ?>
</div>
<div id="bar" style="height:420px; width:6px; display:inline-block;">
<img src="http://e404.ca/wp-content/uploads/SliderBar.png">
</div>
</div>
Basicly, I want the two with “bar” as ID to disappear when page is smaller than 1220px.
I would like a solution which work without jQuery. My website, if you want to take a look a the slider is : http://e404.ca
Hope you can help…!
This should do the trick, put on you css:
And another thing, never use the same ID to different elements, use class instead.
You Can use jScroll in J Query. Its actually a plug-in for lazy loading.
At first it only loads the front view. ie the content that you can see at first and as you scroll down the rest of the content is loaded.
Look Here for the plugin.
You won’t require Javascript for this.
Have a look on this article as it has all the information you will require.
Basically you will apply different CSS depending on the browser’s size.
The above for example will load only if the browser width is smaller than 1220.
In this css you can have a rule to make the div disappear like:
I wouldn’t advise you to user one CSS for everything because as your website grows bigger it will get quite hard to manage it. Multiple CSS files for different resolutions will make your life easier in the future.
Hope this helps