how can I get my active tab & segment to display on the initial page load - my tabs load remotely using ajax and all work when you click on them, but on first page load the tab segment is empty :
<div class="ui tabular menu grid">
<div class="ui container">
<a class="item active tabby" data-tab="home"><i class="large home icon">
</i>Home</a>
<a class="item tabby" data-tab="two"><i class="large chart bar icon"></i>Two</a>
<a class="item tabby" data-tab="three"><i class="large calendar icon"</i>Three</a>
<a class="item tabby" data-tab="four"><i class="large clock icon"></i>Four</a>
</div>
</div>
<div class="ui center aligned grid">
<div class="ui container">
<div class="ui tab active segment " data-tab="home"></div>
<div class="ui tab segment" data-tab="two"></div>
<div class="ui tab segment" data-tab="three"></div>
<div class="ui tab segment" data-tab="four"></div>
</div>
</div>
To initialise:
$('.tabular.menu .item')
.tab({
cache: false,
evaluateScripts : true,
auto : true,
path : '/dashboard',
ignoreFirstLoad: false,
alwaysRefresh: true
});
I encountered the same issue, when the page loads the first or 'active' tab will open and display the contents defined by the html source, but it does not auto-load. However, clicking on the tab causes the auto-load to occur.
I have just read an article which suggests that jQuery does not fire the activate event on the first tab when it is created. If this is true then it might explain why this happens. jQuery bug report
My solution is to programatically activate the tab. The semantic ui documentation mentions doing this, but the information is a bit vague: find it in 'Tabs - Usage': where it refers to 'Initialising Tabs ... without Menus'. Semantic UI - Tabs - usage
Tabs can be activated with jQuery:
$.tab('change tab','tab-name');
where 'tab-name' is the 'path' you specified in 'data-tab="tab-name"'. At first I found that this just opened and closed the tab without auto-load, until I used a jQuery selector which selected the MENU item, not the TAB item, then the auto-load worked.
So, I activate the tab just after initializing the tabs in the Document.Ready function:-
$('#infotabs .menu .item')
.tab({
auto: true,
path: '/pathto/'
})
$('#infotabs .menu .item').tab('change tab','tab1.php')
;
This is the corresponding HTML:
<div id="infotabs">
<div class="ui top attached tabular menu">
<a class="active item" data-tab="tab1.php">tab1</a>
<a class="item" data-tab="tab2.php">tab2</a>
<a class="item" data-tab="tab3.php">tab3</a>
</div>
<div class="ui active bottom attached tab segment" data-tab="tab1.php">
1
</div>
<div class="ui bottom attached tab segment" data-tab="tab2.php">
2
</div>
<div class="ui bottom attached tab segment" data-tab="tab3.php">
3
</div>
</div>
Related
I'm using semantic-ui-vue
for a project.But there is problem in sidebar height.. here is my code.. how to set sidebar height for screen size.
<sui-sidebar-pushable class="ui attached segmant" >
<sui-sidebar animation="overlay" class="inverted" :visible="visible" >
<a class="item">1</a>
<a class="item">2</a>
<a class="item">3</a>
</sui-sidebar>
<sui-sidebar-pusher :dimmed="visible" #click="visible = false">
<div class="ui container">
<div>
<button class="ui button" #click.stop="visible = true">Menu</button>
</div>
<!-- site content -->
Content Goes here <br>
</div>
</sui-sidebar-pusher>
</sui-sidebar-pushable>
enter image description here
I want to create the same design like chrome settings page
https://www.pcworld.com/article/3162716/software/how-to-switch-to-chromes-material-design-settings-page-for-an-easier-experience.html
I do not manage to put the md-switch at the right and in static position like chrome settings
I do manage to put the md-switch in right to the title but I need it always in the middle of the card stick to right.
Image of my result: (current design)
<md-card md-theme="{{ showDarkTheme ? 'dark-purple' : 'default' }}" md-theme-watch>
<div class="option-item">
<div class="option-item-header">
<div class="option-item-header-title">
title
</div>
</div>
<div class="clear"></div>
<div class="option-body">
<p>text</p>
</div>
</div>
<div class="option-switch">
<md-switch ng-model="vm.model" aria-label="active" ng-change="function()">
</md-switch>
</div>
</md-card>
How can I replicate the wizard modal menu? I like the style of the wizard modal but don't require the behaviour of a wizard ie. steps validation etc.
I'm currently using the clr-tree-node for my menu with the grid which gets me close to the wizard style but it would be great to match it exactly.
This is what I have at the moment:
<clr-modal [(clrModalOpen)]="display" [clrModalSize]="'lg'" [clrModalClosable]="true">
<h3 class="modal-title">Preferences</h3>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<clr-tree-node *ngFor="let menuItem of menu" >
<a class="clr-treenode-link" [class.active]="menuItem.id === activeMenuItem" (click)="toggleContent(menuItem)">{{menuItem.name}}</a>
<ng-template [clrIfExpanded]="expandedCheck(menuItem.id)" *ngIf="menuItem | objectHas:'subMenu'">
<clr-tree-node *ngFor="let subMenuItem of menuItem.subMenu">
<a class="clr-treenode-link" [class.active]="subMenuItem.id === activeMenuItem" (click)="toggleContent(subMenuItem)">{{subMenuItem.name}}</a>
</clr-tree-node>
</ng-template>
</clr-tree-node>
</div>
<div class="col-md-8">
<form [formGroup]="form">
<h4>General</h4>
<button class="ui button" #click="beforeAdd">添加</button>
<div class="ui modal">
<div class="header">Header</div>
<div class="content">
<div class="description">
<p>Description</p>
</div>
</div>
<div class="actions">
<div class="ui negative right labeled icon button">
取消
<i class="remove icon"></i>
</div>
<div class="ui positive right labeled icon button">
提交
<i class="checkmark icon"></i>
</div>
</div>
</div>
view methods:
beforeAdd(){
const modal = $(this.$el).find('.ui.modal')
console.log(modal)
modal.modal('show')
}
first click,modal show, second click nothing happened, I found semantic change modal to root for div class='ui dimmer modals page transition hidden',how can solve it
Semantic is removing it from your $(this.$el) so next time it does not find it.
It works when you use with global $ and an id:
show(){
const showModal = $('#mymodal')
console.log(showModal)
showModal.modal('show')
}
See Updated fiddle.
If you also want to use Vue variables in your modal, it is necessary to clone the modal and only show the cloned version.
With this approach Vue will still be able to keep track of the original modal, because Semantic doesn't remove it from the DOM.
beforeAdd(){
const modal = $(this.$el).find('.ui.modal').clone()
console.log(modal)
modal.modal('show')
}
I have a list of items in one of my view.
I can only fit up to 6 items, and it's laid out like this:
I used class="col-md-2" for each one.
When I have more than 6, it just simply go down to the another row.
I don’t want that. You can see it here.
Now, if the list has 6 or more items,
list them horizontally
show the big > so that the users will know that there is more
show the 2 dots in the middle
Edit
This is what I got so far. I used Larval 4 so this syntax is in HTML/Blade.
#foreach ( MarketingMaterialCategory::all() as $mmc )
<h2><i class="fa fa-file-image-o color lighter"></i> {{{ $mmc->name or '' }}} <small> </small></h2>
<div class="row">
#foreach ( MarketingMaterial::where('marketing_materials_category_id','=', $mmc->id )->get() as $marketing_material)
<div class="col-md-2" >
<!-- Shopping items -->
<div class="shopping-item">
<!-- Image -->
<div class="col-sm-12 imgbox" >
<!-- <span class="col-sm-6"></span> -->
<img class="col-sm-12 pull-right" width="200" src="/marketing_materials/{{$marketing_material->id}}/download/thumb_path" alt="" />
</div>
<!-- Shopping item name / Heading -->
<h6>{{{ $marketing_material->title or '' }}}<span class="color pull-right">{{ FileHelper::formatBytes($marketing_material->media_size,0) }}</span></h6>
<!-- Shopping item hover block & link -->
<div class="item-hover bg-color hidden-xs">
Download
</div>
</div>
</div>
#endforeach
</div>
<hr>
#endforeach
Can someone help me how to resolve this ?
Bootstrap doesn't support that kind of scrolling. However, I have used this JavaScript library in the past and it does pretty much exactly what you want: Slick.js
It is very flexible and it will only show the scrolling options if it can't display all the contents on the page.
If you use it though, do not use the bootstrap col-md-2 classes, just set a manual width.