Found something that i cant understood.
Had a side menu with semantic ui, the dropdown menu from the side menu is not working when i host the file locally, but it is working fine if i put it in jsfiddle
Here is the working jsfiddle https://jsfiddle.net/7rcrx8c4/
index.html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.js"></script>
</head>
<body>
<div id="main" class="ui container">
<div class="ui top attached menu">
<a class="item" id="menu"><i class="sidebar icon"></i>Menu</a>
<div class="right menu">
<a class="item"><i class="user icon"></i>Welcome : Foo</a>
</div>
</div>
<br />
</div>
<div class="ui left vertical sidebar menu">
<div class="item">
<i class="grid layout icon"></i>Menu
</div>
<!-- Master menu -->
<div class="ui dropdown item">
<span class="text"><i class="book icon"></i></span>
<i class="dropdown icon"></i>Master
<div class="menu">
<a class="item">a</a>
<a class="item">b</a>
</div>
</div>
<!-- End master -->
</div>
<script>
$('.ui .dropdown').dropdown({
on: 'hover'
});
$('.ui.left.sidebar').sidebar({
transition: 'overlay'
});
$('.ui.left.sidebar')
.sidebar('attach events', '#menu');
</script>
</body>
</html>
style.css
.ui.sidebar {
overflow: visible !important;
}
Can some one point me where i make a mistake?
Found out the reason,
style.css should be loaded after semantic.css
Thanks all for the time
Related
For some reason the dropdown in my navbar is not working. The dropdown button is there but it is not dropping, so there is probably something wrong in the triggering part of the dropdown. I've tried everything but I can't fix it, any help is appreciated. Here is the link to the documentation of materialize: https://materializecss.com/navbar.html
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Casual Clothing comparer</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
</head>
<body>
<!-- Dropdown Structure -->
<ul id="dropdown1" class="dropdown-content">
<li>one</li>
<li>two</li>
<li class="divider"></li>
<li>three</li>
</ul>
<nav>
<div class="nav-wrapper">
Logo
<ul class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<!-- Dropdown Trigger -->
<li><a class="dropdown-trigger" href="#!" data-target="dropdown1">Dropdown<i class="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
<div class="row">
{% for post in final_products %}
<div class="col s12 m6 l4">
<div class="card horizontal hoverable z-depth-1-half">
<div class="card-image" id="card_image" style="height:300px">
<img src="{{ post.6 }}">
</div>
<div class="card-stacked">
<div class="card-content">
<span class="card-title">{{ post.0 }}</span>
<p>Initial Price €{{ post.3 }}</p>
<p>Discount {{ post.7 }}%</p>
<p style="margin-top: 10px; font-size: x-large">Price €{{ post.2 }}</p>
</div>
<div class="card-action">
Buy
</div>
</div>
</div>
</div>
{% endfor %}
</div>
<footer id="sticky-footer" class="py-4 bg-dark text-white-50">
<div class="container text-center">
<small>Copyright © Your Website</small>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
$(document).ready(function(){
//Initialize dropdown
$(".dropdown-trigger").dropdown();
});
</script>
</body>
</html>
The $(document) is a jQuery selector and you did not included a path for the jQuery.
I added the following line to your code and the drop-down works fine: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>. You can read more about this here.
The line of code should be included before the following:
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
The reason why your code did't worked is that Materialize CSS uses jQuery methods.
I am newbie in CSS and Bootstrap and was trying to create a image gallery using Bootstrap Grid In which I am using One row class and under which i am using col-lg-4 class for 3 columns in the container and if i am using 2 separate rows then the grid is working as i want.
but if i am using only one row class then the first 3 images are arranged properly as i want and if i am adding the fourth image in the same row then the image should automatically move into the second row and it is moving in second row too but in the second column not the first. Due to this reason the images are not correctly positioned. Any one can explain? and tell me what i am doing wrong?
below is the html code.
body {
font-family: "Bebas Neue";
}
.navbar-brand {
letter-spacing: 2px;
}
.nav {
letter-spacing: 2px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Linking Bootstrap CSS -->
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"
/>
<!-- LINKING JQuery -->
<script src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin="anonymous"></script>
<!-- Linking Bootstrap JAVASCRIPT -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Bebas+Neue&display=swap" rel="stylesheet"/>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Image Gallery</title>
</head>
<body>
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button
type="button"
class="navbar-toggle collapsed"
data-toggle="collapse"
data-target="#bs-nav-demo"
aria-expanded="false"
>
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<strong>J.Photography</strong>
</div>
<div class="collapse navbar-collapse" id="bs-nav-demo">
<ul class="nav navbar-nav">
<li>About</li>
<li>Contact</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Sign Up</li>
<li>Login</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="jumbotron">
<h1>The Image gallery</h1>
<p>A bunch of beautiful Pictures from Around the Globe!</p>
</div>
<div class="row">
<div class="col-lg-4">
<div class="thumbnail">
<img
src="https://d37b3blifa5mva.cloudfront.net/000_clients/1431025/page/1431025kkXelCOx.jpg"
alt=""
/>
</div>
</div>
<div class="col-lg-4">
<div class="thumbnail">
<img
src="https://d37b3blifa5mva.cloudfront.net/000_clients/1431025/page/1431025Oq0YQLZZ.jpg"
alt=""
/>
</div>
</div>
<div class="col-lg-4">
<div class="thumbnail">
<img
src="https://d37b3blifa5mva.cloudfront.net/000_clients/1431025/page/1431025u5zYFC6n.jpg"
alt=""
/>
</div>
</div>
<div class="col-lg-4">
<div class="thumbnail">
<img
src="https://d37b3blifa5mva.cloudfront.net/000_clients/1431025/page/1431025kkXelCOx.jpg"
alt=""
/>
</div>
</div>
<div class="col-lg-4">
<div class="thumbnail">
<img
src="https://d37b3blifa5mva.cloudfront.net/000_clients/1431025/page/1431025Oq0YQLZZ.jpg"
alt=""
/>
</div>
</div>
<div class="col-lg-4">
<div class="thumbnail">
<img
src="https://d37b3blifa5mva.cloudfront.net/000_clients/1431025/page/1431025u5zYFC6n.jpg"
alt=""
/>
</div>
</div>
</div>
</div>
</body>
</html>
I think the images you added have different height, try give your image a fixed height to get aligned equally.
I have three pages: main.html, nav.html, sidebar.html
I've separated nav and sidebar for my project. In the nav page, I have button for collapsing the sidebar page. I am using bootstrap framework for the theme. But when I separate it, the sidebar doesn't collapse while the button on nav is clicked. Here are the code of main.html
<link href="global/css/icons/icomoon/styles.css" rel="stylesheet" type="text/css">
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="global/js/main/jquery.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$( "#nav" ).load( "inc/nav.html" );
$( "#sidebar" ).load( "inc/sidebar.html" );
});
</script>
<div id="nav"></div>
<div class="page-content" style="padding-bottom:70px;">
<div id="sidebar"></div>
<div class="content-wrapper bg-white">
<div class="content">test</div>
</div>
</div>
And this is nav.html
<div class="navbar navbar-expand-md navbar-dark bg-indigo navbar-static" style="background:#81018d;">
<div class="navbar-brand">
<a href="#" class="d-inline-block">
<img src="../../assets/images/logo/headerwhite.png" alt="">
</a>
</div>
<div class="d-md-none">
<button class="navbar-toggler sidebar-mobile-main-toggle legitRipple" type="button">
<i class="icon-paragraph-justify3"></i>
</button>
</div>
</div>
And sidebar.html
<div class="sidebar sidebar-dark sidebar-main sidebar-expand-md">
<div class="sidebar-content">
<div class="card card-sidebar-mobile">
<ul class="nav nav-sidebar" data-nav-type="accordion">
<li class="nav-item-header"><div class="text-uppercase font-size-xs line-height-xs">Main</div> <i class="icon-menu" title="Main"></i></li>
<li class="nav-item">Menu Beranda</li>
<li class="nav-item">Transaksi</li>
</ul>
</div>
</div>
</div>
How to make the pusher not dim when I trigger the semantic-ui sidebar?
I tried the semantic-ui sidebar as follows:
$(document).ready(
function() {
$('.button').click(
function() {
$('.ui.sidebar')
.sidebar('toggle');
}
)
});
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
<button class="ui button">trigger</button>
<div class="ui right demo sidebar vertical inverted menu push visible" style="">
<a class="header item">File Permissions</a>
<a class="item">Share on Social</a>
<a class="item">Share by E-mail</a>
<a class="item">Edit Permissions</a>
<a class="item">Delete Permanently</a>
</div>
The pusher content should not be dimmed when sidebar is triggered.
You can control the dimmer behavior of the sidebar with the dimPage setting. You can prevent dimming as follows:
$('.ui.sidebar').sidebar('setting', 'dimPage', false);
Here is an example snippet:
$(document).ready(() => {
$('.ui.sidebar').sidebar('setting', 'dimPage', false);
$('#hamburger').click(() => {
$('.ui.sidebar').sidebar('toggle');
});
});
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
<div class="ui sidebar inverted vertical menu">
<a class="item" href="#">Item 1</a>
<a class="item" href="#">Item 2</a>
</div>
<div class="pusher">
<div class="ui container">
<button class="ui button" id="hamburger">
<i class="sidebar icon"></i>
</button>
<p>Some content</p>
</div>
</div>
I'm experiencing issues with the drawer in my asp.net mvc mobile application. After a lot of hassle (and possibly a few bugs in the asp.net mvc helpers) I decided to roll back to a javascript layout for my app.
The only problem I have is that I've implemented a drawer-menu that does not seem to work properly.
For some reason, Kendo generates a # in the middle of my url, causing the drawer to not show.
This is the url when it doesn't work:
http://localhost:55683/#/UnitDetails/Index/2
And here it is when it works:
http://localhost:55683/UnitDetails/Index/2#/
Here's my markup in my shared _Layout.cshtml:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="#Url.Content("~/Content/kendo/2013.2.716/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="#Url.Content("~/Content/kendo/2013.2.716/kendo.mobile.all.min.css")" rel="stylesheet" type="text/css" />
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Scripts/kendo/2013.2.716/kendo.all.min.js"></script>
<script src="~/Scripts/kendo/2013.2.716/kendo.mobile.min.js"></script>
<link href="#Url.Content("~/Content/kendo/2013.2.716/kendo.dataviz.flat.min.css")" rel="stylesheet" type="text/css" />
</head>
<body>
#RenderBody()
<!--Main Layout -->
<div data-role="layout" data-id="mainLayout">
<div data-role="header">
<div data-role="navbar">
<span data-role="view-title"></span>
</div>
</div>
<div data-role="footer">
<div data-role="tabstrip">
<a data-icon="action" href="~/Logout">Logout</a>
</div>
</div>
</div>
</body>
</html>
And here's the Index.cshtml of my UnitDetails-view:
<!-- Drawer layout -->
<div data-role="layout" data-id="drawer-layout">
<header data-role="header">
<div data-role="navbar">
<a data-role="button" data-rel="drawer" href="#my-drawer" data-icon="drawer-button" data-align="left"></a>
<span data-role="view-title"></span>
#*<a data-align="right" data-role="button" class="nav-button" href="#index">Index</a>*#
<a data-align="right" data-role="backbutton">Back</a>
</div>
</header>
</div>
<div id="drawer-home" data-role="view" data-layout="drawer-layout" data-title="Unit Details">
<!-- Content removed for readability -->
<div data-role="footer">
</div>
</div>
<div data-role="drawer" id="my-drawer" style="width: 270px" data-views="['drawer-home']">
<ul data-role="listview" data-type="group">
<li>Mailbox
<ul>
<li data-icon="inbox">Inbox</li>
</ul>
</li>
</div>
<script>
window.app = new kendo.mobile.Application(document.body, {
layout: "drawer-layout",
transition: "fade",
skin: "flat",
hideAddressBar: true
});
</script>
There was a bug with the kendo mobile drawer 2013.2.918 and was fixed with a later internal build. Try some debugging by removing the data-views attribute from the drawer. But this will cause the drawer to be displayed in all views via swipe.