Re: [jQuery] The use of !important
Am 01.01.2010 um 20:43 schrieb cybervigilante: > I'm learning jQuery and using it with Joomla, which has huge style > sheets. Things that worked in my simple HTML training page didn't in > Joomla, due to CSS conflicts. I realized that although its use is > discouraged in a style sheet, !important makes things a lot easier if > I use it in my small jQuery CSS classes. [...] Right. !important does the trick whenever we struggle with thirdparty CSS. Nonetheless it shows what bad (inheritance) and unstructured CSS is out there. Even in popular CMS Systems like Joomla a.s.o. Well-organized CSS does not require to overwrite (and breaking) the inheritance chain. bye Olaf -- creatics : Inh. Olaf Gleba o...@creatics.de : http://creatics.de PGP-Key http://creatics.de/keys/
[jQuery] Re: Safari and .remove()
I was wrong. The removal works. But it seems, that clicking on a link which removes the DOM link tag doesn't affect the browser rendering. So the DOM link tag is removed, but i still get a unaltered pageview. This regards to Safari Mac and also IE 7 Win. On FF 2/3 (Mac, Win) all is fine: Clicking on a link to reset the pageview, the appropriate link tag is removed from the DOM AND the styles of the former appended stylesheet doesn't affect the pageview no longer. Thanks for your help. bye Olaf Am 13.02.2009 um 13:05 schrieb Karl Rudd: If the removal really doesn't work you could try disabling the link. $(linkHere).attr('disable',true). Karl Rudd On Fri, Feb 13, 2009 at 7:22 PM, Olaf Gleba wrote: Hi. On a click event i DOM insert (append) a LINK tag into the head. var s = document.createElement('link'); s.href='/gtpls/'+target+'.css'; s.rel = 'stylesheet'; s.type = 'text/css'; s.media = 'screen'; $('head').append(s); There is a link to the former created DOM Element to set all to standard, e.g. restores the standard view. $('a[rel=default]').click(function() { $('HEAD').find('link[href=]').remove(); ... }); Everythings fine except Safari 3.2.1. It seems to find the target link tag (gives me 1 when i check length), but doesn't remove it on the fly. Is that a known issue on safari? Any hints to achive the desired behaviour? greets Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 o...@creatics.de : http://www.creatics.de PGP-Key http://www.creatics.de/keys/ Welcompose CMS - Einfach und Effizient http://www.welcompose.de gruss Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 o...@creatics.de : http://www.creatics.de PGP-Key http://www.creatics.de/keys/ Welcompose CMS - Einfach und Effizient http://www.welcompose.de
[jQuery] Safari and .remove()
Hi. On a click event i DOM insert (append) a LINK tag into the head. var s = document.createElement('link'); s.href='/gtpls/'+target+'.css'; s.rel = 'stylesheet'; s.type = 'text/css'; s.media = 'screen'; $('head').append(s); There is a link to the former created DOM Element to set all to standard, e.g. restores the standard view. $('a[rel=default]').click(function() { $('HEAD').find('link[href=]').remove(); ... }); Everythings fine except Safari 3.2.1. It seems to find the target link tag (gives me 1 when i check length), but doesn't remove it on the fly. Is that a known issue on safari? Any hints to achive the desired behaviour? greets Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 o...@creatics.de : http://www.creatics.de PGP-Key http://www.creatics.de/keys/ Welcompose CMS - Einfach und Effizient http://www.welcompose.de
[jQuery] Re: Accessing object tag by id
Thanks. I already use swfobject. Still a good idea to look into the lib to (maybe) find something there... greets Olaf Am 06.02.2009 um 09:18 schrieb jQuery Lover: You might wanna use this: http://jquery.thewikies.com/swfobject/ Or look into the code. May find clues there... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Fri, Feb 6, 2009 at 1:11 PM, Olaf Gleba wrote: Sorry, but anyone has a clue ? Am 05.02.2009 um 11:43 schrieb Olaf Gleba: Couldn't find any appropriate answer: How do i point to a object tag by ID ? Example: $('#flashsitemap').event(function() { ... }); This assumed syntax does not work obviously gruss Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 o...@creatics.de : http://www.creatics.de PGP-Key http://www.creatics.de/keys/ Welcompose CMS - Einfach und Effizient http://www.welcompose.de gruss Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 o...@creatics.de : http://www.creatics.de PGP-Key http://www.creatics.de/keys/ Welcompose CMS - Einfach und Effizient http://www.welcompose.de
[jQuery] Re: Accessing object tag by id
Sorry, but anyone has a clue ? Am 05.02.2009 um 11:43 schrieb Olaf Gleba: Couldn't find any appropriate answer: How do i point to a object tag by ID ? Example: $('#flashsitemap').event(function() { ... }); This assumed syntax does not work obviously gruss Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 o...@creatics.de : http://www.creatics.de PGP-Key http://www.creatics.de/keys/ Welcompose CMS - Einfach und Effizient http://www.welcompose.de
[jQuery] Accessing object tag by id
Hi. Couldn't find any appropriate answer: How do i point to a object tag by ID ? Example: $('#flashsitemap').event(function() { ... }); This assumed syntax does not work obviously. But. If i have an embed tag within the object tag everything's fine. http://www.creatics.de PGP-Key http://www.creatics.de/keys/ Welcompose CMS - Einfach und Effizient http://www.welcompose.de
[jQuery] Re: Question to parent() versa DOM parentNode
Hi. Sorry for the late reply. Am 16.10.2008 um 02:33 schrieb Mike Alsup: I ask because i get different results while traversing some Nodes with DOM Style and jquery approach. How are the results different? I have to revoke my question ;) It was a mistake by myself ;-) While the DOM Function returns the attribute (for), i expected the same for the jquery syntax i wrote. But i missed that my jquery syntax only contains the object itself at this point. Thanks for your asking. greets Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 [EMAIL PROTECTED] : http://www.creatics.de PGP-Key http://www.creatics.de/keys/
[jQuery] Question to parent() versa DOM parentNode
Hi. Does the jquery parent() traversing the same as the DOM 'parentNode' ? I ask because i get different results while traversing some Nodes with DOM Style and jquery approach. jquery Style: $(elem).parent().parent().attr('for'); (Prototype) Helper function with plain DOM Javascript: function Helper_getAttrParentNode (attr, elem, level) { for (var a = elem; level > 0; level--) { a = a.parentNode; } return a.getAttribute(attr); } Usage: Helper.getAttrParentNode('for', elem, 2) Which both of them should do the same thing. Or do i miss something here? Thanks in advance. bye Olaf -- Olaf Gleba : creatics media.systems Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225 [EMAIL PROTECTED] : http://www.creatics.de PGP-Key http://www.creatics.de/keys/
[jQuery] Execute a function within a jquery method
Hi. Probably a lack of understanding jquery/javascript. Is it possible to append (or something simular) a excecutable function call within a jquery event call? I want to execute the function AC_FL_RunContent(params) of the on top of page loaded AC_RunActiveContent.js to embbed Flash files depending of a special click event. Urg, what a sentence. To make this a little more clear: Example: $(elem).click(function() { ... do some stuff... $(elem-to-process).append(AC_RunContent(params)); }); While this above will only print clear text, i tried to wrap the function call within append in a
[jQuery] Re: Order of presence of DOM Elements
Hi Mike. Am 06.04.2008 um 03:09 schrieb Michael Geary: Olaf, I take it that "mySettings" is a variable defined in your set.js script, is that right? Right. You should change set.js to call a function instead of merely setting a variable. The function it calls will be where you put the code that depends on mySettings. Thanks a lot for your hint. gruss Olaf -- Olaf Gleba : creatics media.systems tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/
[jQuery] Order of presence of DOM Elements
Hi. I think i have a problem of understanding in what order the nodes get into the DOM. I have a select that is bound to different Text-Converter which is present within all content input areas in our little CMS. I integrated the markItUp! Editor successfully at least (thanks Jay for the hints). Fortunately there are Text-Converter Plug-Ins available yet which fits perfectly with the parsing options we afford. So i of course must take action on every 'onchange' of the select to load at least the 'set.js' of the appropriate set and insert it into the DOM to make them available. This is what i want to achive described within the example below (excerpt,- the 'onload' handling of page skipped). But everytime i select an option firebug gives me a 'mySettings are not defined'. So it seems the dynamically generated script tag are 'too late'. Anyone has a hint what i do wrong? bye and thanks in advance Olaf /* Example start here */ jQuery(document).ready(function(){ // Foremost Mozilla browser only jQuery('#simple_page_text_converter option').click(function() { var t = jQuery(this).text().toLowerCase(); var s=document.createElement('script'); s.setAttribute('src','../static/libs/thirdparty/markitup/sets/' + t + '/set.js'); s.setAttribute('type','text/javascript'); document.getElementsByTagName('body')[0].appendChild(s); ... jQuery('#simple_page_content').markItUp(mySettings); }); }); /* Example ends here */ -- Olaf Gleba : creatics media.systems tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/
[jQuery] Re: [ANNOUNCE] markItUp! 1.0 (former jTagEditor) is finally released!
Hi Jay. Am 03.04.2008 um 11:58 schrieb Jay Salvat: [...] I hope my explainations and my english will be clear enough to help you. Many thanks for your detail description! I will work on these solutions and will post the result here. Again, many thanks. bye Olaf -- Olaf Gleba : creatics media.systems tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/
[jQuery] Re: [ANNOUNCE] markItUp! 1.0 (former jTagEditor) is finally released!
Hi Jay. Am 23.03.2008 um 19:48 schrieb Jay Salvat: I'm proud to announce you the official release of markItUp! (former jTagEditor) and markItUp! website. I hope everything will be ok and i forgot nothing important. Its great. I like the approach. After playing around a little, it sure is a candidate for integration in the next release of our CMS. Since there is a lot of customized DOM Javascript action focused on the main content textarea, the switch of the ID* makes me hesitate a bit because it would causes a lot of refactoring in all custom libs. Many functions rely on the textarea ID selection. Am i missing something? Or is there a way to prevent the ID switch? *) markItUp rips off the id from the textarea and uses it on the surrounding container. greets Olaf -- Olaf Gleba : creatics media.systems tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/
[jQuery] Re: Selectors
Am 05.11.2007 um 14:02 schrieb boermans: Perhaps this: $('img',e).attr({src: "path/to/image"}); Brilliant. And of course you are right - href is likewise src an attribute, not a tag ;) typo... thx a lot Olaf
[jQuery] Selectors
Hi. I have a reference to 'this', which is a href tag. This href contains as the only child a image. I want to select only this image, to modify his src attribute. This works: // 'e' is my reference to 'this' var i = $(e).children(); $(i).attr({src: "path/to/image"}); But i think there must be a shorter and more elegant way to do this like for example: $(e + :'only-child').attr({src: "path/to/image"}); but this unfortunately doesn't work. Any hint is appreciated greets Olaf -- Olaf Gleba : creatics media.systems tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/
[jQuery] Re: Defining and using of JSON defaults/options
Little Correction for the second example (needless '()' in chain). Am 01.11.2007 um 09:22 schrieb Olaf Gleba: Example (doesn't works): var uToggle = { animationType: 'fadeIn', speed: 'fast' ... xxx: function(e) { $(e).parent().next().uToggle.animationType()(uToggle.speed); } }; ... xxx: function(e) { $(e).parent().next().uToggle.animationType(uToggle.speed); ... -- Olaf Gleba : creatics media.systems tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/
[jQuery] Defining and using of JSON defaults/options
Hi. I know, strange topic description. But i didn't know how to describe it a better way. Example (works): var uToggle = { speed: 'fast' ... xxx: function(e) { $(e).parent().next().fadeIn(uToggle.speed); } }; Example (doesn't works): var uToggle = { animationType: 'fadeIn', speed: 'fast' ... xxx: function(e) { $(e).parent().next().uToggle.animationType()(uToggle.speed); } }; I guess its a simple syntax matter: How must i declare the animationType default/option value in the chain? Only using the Speed default (like in the first example) works as the fadeIn/Out() expects a string for the speed value. But if i want to define a option for e.g. the animation type itself, i fail to define it correctly in the chain. Could anyone get me a hint how to do it? Thanks. greets Olaf
[jQuery] Re: Why does my ajax call fail ? (when it is called the second time) ??
Am 24.04.2007 um 07:49 schrieb naveman: that is my code, my comments show my problem. i tried not onle jquery.html() but also any other possibilty to update the innerHTML. so i am really wierd about that, since it has no error. Since the call is excecuted correctly the first time, it may has something do with the rebinding of your behaviours. Whats your bindBehaviour() func. looks like? Is it defined as a expression or declaration? If is defined as an expression, is it defined before(!) using it as a callback? bye Olaf
[jQuery] Re: Defining of a function
Am 13.04.2007 um 00:13 schrieb Olaf Gleba: I wondered if there's maybe some speed issue on that topic. But as far as i read about it now, its only a question at which point the function object is available. good resource either: http://developer.mozilla.org/en/docs/ Core_JavaScript_1.5_Reference:Functions -- Olaf Gleba
[jQuery] Re: Defining of a function
Am 12.04.2007 um 18:16 schrieb Mike Alsup: The difference between a function declaration and a function expression is when the actual "function object" gets created. The easiest way to think of it is that function declarations are always available and function expressions are not available until they have been evaluated. [...] Many thx to all responders! I wondered if there's maybe some speed issue on that topic. But as far as i read about it now, its only a question at which point the function object is available. Again, thx for figure this out. -- Olaf Gleba
[jQuery] Defining of a function
Hi, Maybe i should take a break,- i don't get the point what differences it makes defining a function as a named or a anonymous function. function xxx () { ... } var xxx = function() { ... } What are the advantages and disadvantages of both of them? Thx in advance. -- Olaf Gleba
[jQuery] Re: Best Method to (re)bind event handlers
Am 11.04.2007 um 06:39 schrieb Yansky: There might be some info in this tutorial that could help you: http://www.learningjquery.com/2006/09/sacrificial-lambda Thx to all who responded to my inital post. Your comments helped a lot. As i use anonymous function as a wrapper yet, i'll try the lambda approach. Seems to fit my needs. greets Olaf -- Olaf Gleba : creatics media.systems tel. +49 (0)212 38 32 94 30 : fax. +49 (0)212 38 32 94 31 [EMAIL PROTECTED] : http://www.creatics.de http://www.creatics.de/keys/ogleba.asc
[jQuery] Best Method to (re)bind event handlers
Hi, the last two days i argue about how to handle (re)binding event handlers in a most elegant and un-redundant way when i work with asynchron injected files. I worked with prototype/Behaviour for the last couple of month, so i need a good approach to refactor this within jquery. So far a defined a function that is used as a callback on .load() functions which load xhr injected files. Within this function (rebindEventHandlers) i define every function that is in use within the injected files (s. appended Example below). First problem is: I don't want to traverse everytime through all functions defined within this rebindEventHandlers callback, because there is possibly no need for all(!) functions to rebind in some case. Of course this could be avoided by defining more callback functions that each only contains the needed functions to rebind and use these func. as separat callbacks. But i think thats ugly... Second problem is: Sometimes (for example the choosen .toogle() functionality, s. below the example code) i'd like to avoid to define 2 functions for overall 1 functionality. Thats ugly too ;) How do you handle this task? I appreciate any comments. Thx in advance. greets Olaf EXAMPLE (structure): $(function(){ var rebindEventHandlers = function() { // example func to toggle some xhr loaded content $("a.toggleBelowLoadedContent").toggle(function(){ var el = $(this).parent(); $(el).next().fadeOut("fast"); $(this).text('Show'); return false; }, function() { var el = $(this).parent(); $(el).next().fadeIn("fast"); $(this).text('Hide'); }); }; // EOF rebindEventHandlers // func outside the defined callback func // loads the xhr file which contains the above toogle functionality // present the rebindEventHandlers as the callback $("a#client").click(function(){ $("div#account").load("/clients/dashboard/client/", rebindEventHandlers); }); // example func to toggle some content on normal loaded sites // See "Second problem"... $("a.toggleBelow").toggle(function(){ var el = $(this).parent(); $(el).next().fadeOut("fast"); $(this).text('Show'); return false; }, function() { var el = $(this).parent(); $(el).next().fadeIn("fast"); $(this).text('Hide'); }); }; // EOF document.ready()