Closed jagooding closed 10 years ago
Got it working! http://jsfiddle.net/xLTuJ/13/
Really hope the @Semantic-Org will put this into the core or as little addon-snippet.
@Anachron HAHAHA, that's awesome man, I'm sitting here racking my head reading through hundreds of lines of code to figure out where that damn semantic variable came from, and you just got rid of it.
@jagooding Welcome, it's coming from http://semantic-ui.com/javascript/semantic.js and I thought you won't include that script anyway, so why not just get rid off the dropdown and the other stuff.
There's an undocumented module in semantic state
which has features for activating different states of UI, i've used it extensively but haven't had time to rewrite some bits, and create documentation.
It's also tied into api
and other behavior components, this will all be part of 1.0
, letting components activate after an API request finishes, or update with information from an AJAX request.
Thanks @jlukic
Do you have an idea on how much rewriting will have to be done for an application once 1.0 comes out? And is there a approximate time for when 1.0 is going to be released?
Late march - april.
There will be a list of breaking changes, most likely these will have little effect unless you are using undocumented components like api
tab
state
and search
which will get modest rewrites.
There will be explicit structure for user overrides and variables, which will affect any codebase that have manual solutions for this currently.
i have applied ur state.js nd my menus stil not change the active selection on a click
jlukic !, hi there!. I just trying semantic ui and i wonder how its the manual solution you mention to get state.js working. Its actually functional ?. regards !.
State allows you to do things like
follow
buttons activate on a page after a successfully activating one button.addClass
removeClass
sprinkled over your siteI recommend using the (latest versions in 1.0 branch)[https://github.com/Semantic-Org/Semantic-UI/tree/css/src/definitions/behaviors]
// immediately activates element
$('.my.button')
.state('activate')
;
// activates element on click
$('.my.button')
.state()
;
// typically you'd define all your templated urls in one config file
$.fn.api.settings.api.follow = '/api/follow/{id}/'
$('.foo.button')
.state()
.api({ action: 'follow' })
;
<div class="ui foo button" data-id="22">
// Changes button between Follow and Following
$('.follow.button')
.state({
text: {
inactive : 'Follow',
active : 'Following'
}
})
;
// Changes text on activation and hover
// The hover text is different when active and inactive
$('vote.button')
.state({
text: {
inactive : 'Vote',
enable : 'Cast Vote',
active : 'Voted',
disable : 'Remove Vote'
}
})
;
Hi jlukic, thanks for the info, well explain too :) I had no time for test that, but i will, and i will post feedbak. regards!.
hi jlukic, i tried your Simple activate example with Tabular menu for my site and its working for me, but its state just show and go like blink.it is not staying activate at all.what to do sir? also how can i learn ui's jquery as you explain in your example.
any luck with this gurutvakarshan? having the same problem.
I am trying to figure out how to get menus to change the active selection on a click, like in http://semantic-ui.com/collections/menu.html
I've got a fiddle set up here, where as you can see, it doesn't update the active selection upon clicking. http://jsfiddle.net/xLTuJ/6/