@munsterlander thank you for reply, but sliding menu not change location.href
It’s Single Page Application without history api. “Preventing double fires” is not enough for this i suppose, if i’ll need to click from other pages, but i’ll try disable the onclick
Евгений Гедройц
@Евгений Гедройц
Posts made by Евгений Гедройц
-
RE: ons-sliding-menu: active item
-
RE: ons-lazy-repeat error in OnsenUI 2
Yes, my project has angular and jQuery. i’m using this code:
<ons-list> <ons-list-item modifier="chevron" class="list_respeak" ons-lazy-repeat="MyDelegate" style="height:40px"> </ons-list-item> </ons-list> <script> var hItem = 40; var MyDelegate = { createItemContent: function(index, oldContent) { if (oldContent) { return oldContent; } var $element = $("<div><span style='opacity: 0.7;'><ons-icon icon='fa-spinner' spin='true'></ons-icon> Загрузка респиков...</span></div>"); var request = $.getJSON('https://baconipsum.com/api/?type=meat-and-filler&sentences=1&callback=?', function(data) { $element.text(data[0]); }); $element.data('request', request); return $element[0]; }, destroyItemContent: function(index, element) { var request = $element.data('request'); request.abort(); }, calculateItemHeight: function(index) {return hItem;}, countItems: function(){ return 10000000; }, destroyItemContent: function(index, element) { console.log("Destroyed item " + index); } } //$('.list_respeak').children('.ng-scope').each(function(){ //console.log($(this).height); //if( $(this).height > hItem ){ //$(this).addClass('overflow'); //} //}); </script>
In Monaca is good(OnsenUI1) I exported my project to my localhost and changed OnsenUI2
If it’s not enough i’ll make codepan -
ons-lazy-repeat error in OnsenUI 2
I used previous version and was ok. Example for jQuery from https://onsen.io/guide/overview.html#UsingLazyRepeat
but now it is retrieving error:angular.min.js:107 ReferenceError: MyDelegate is not defined at eval (eval at <anonymous> (http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:2:10925), <anonymous>:1:1) at Class.extend._getDelegate (http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:2:10909) at Class.extend.init (http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:2:10066) at new Class (http://localhost/www/components/monaca-onsenui/js/onsenui.min.js:3:22935) at http://localhost/www/components/monaca-onsenui/js/angular-onsenui.min.js:4:2064 at aa (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:73:90) at K (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:62:39) at g (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:54:410) at K (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:61:488) at g (http://localhost/www/components/monaca-onsenui/js/angular/angular.min.js:54:410) <ons-list-item modifier="chevron" class="list_respeak list__item list__item--chevron" ons-lazy-repeat="MyDelegate" style="-webkit-user-select: none; touch-action: pan-y; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
-
ons-sliding-menu: active item
What a simple way is to determine “active item” in the ons-sliding-menu?
I need this to add a class and add “prevent repeating clicks” if current page is open(it’s breaks my script). I have been checking code, forum, doc alreadyhm… maybe simple is add “toggle class”
-
RE: ons-sliding-menu
Why do not you do easy way with “back-button” in sliding menu, like in a navigator?
i saw this example:
http://codepen.io/frankdiox/pen/qEyvxB
p.s. wrong links -
RE: ons.platform
@Fran-Diox thank you for explanation. I not quite understood description isWebView(). This is obvious now :)
-
RE: How to upgrade from v1 to v2 Onsen.io
This bug was because this code
<script> document.addEventListener("init", function(event) { if (event.target.id == "phrases") { console.log("works"); } }, false); </script>
but i do not got error in console…
I inserted this code in v1.3 yet -
RE: How to upgrade from v1 to v2 Onsen.io
@argelius , please tell me what is new for Sliding Menu. This code not work and have not any errors, in v2
<a href="#" onclick="menu.setMainPage('chapters.html')">
I tryed to compare my code with example v2, but do not see differences
-
RE: ons.platform
suggestion add methods: isApp() and isWeb()
For example, i need set buttons in site, but hide them in app. Resolution is bad way -
RE: ons-icon
If icons not displaying
https://github.com/argelius/favorite-star/issues/2