[jQuery] Scrolling Table sets scroll position in overfloe:hidden div - Scroll is lagging
Hello, I have a div with a table inside. The div is set to a width and an overflow of auto. Scroll works great. The problem is, I have set an event on the div to check when it is scrolling. I take the scrollTop() function and assign it to the scrollTop() of another div with a css property of overflow:hidden. When I scroll the the scrollable div the other div scrolls too but it lags about 1 to two pixles behind. Does anyone know how to make it scroll correctly without a lagg? Thanks var scrollheight = 0; var scrollHorz = 0; $('div#tablewrap').scroll(function(){ scrollheight = $(this).scrollTop(); scrollHorz = $(this).scrollLeft(); $('div#fixed-horz-scroll').scrollTop(scrollheight); // This becomes very jerky $('div#productsDiv').scrollLeft(scrollHorz); // This becomes very jerky });
[jQuery] Re: JSONP - not using PHP - having problems
Ok nevermind I figured it out. So the html file should just contain myfunction({json:object}) and the html page catching should have $.getJSON(http://www.simplifieddesign.biz/jsonTest.html? myfunction=?); function myfunction(data){ alert(data.json); // displays object } Make sure you have ?yourFunctionName=? where yourFunctionName is the name of the sending html files javascript function name. That was my problem. Thanks On Jul 9, 3:48 pm, Wes Duff [EMAIL PROTECTED] wrote: Hello, I have read over almost every post in this group and still cannot figure this out. I am sure it has to do with the way I am creating my JSON object. Here is the file I am broadcasting the file from.http://www.simplifieddesign.biz/jsonTest.html The source does not include any htmlhead or body just the json I did have var jsonObject = {object1 : test, object2 : test2} and var jsonObject = ({object1 : test, object2 : test2}) Onhttp://example.com/develop/wduff/cols/default.html I have this script in the header $.ajax({url: http://www.simplifieddesign.biz/jsonTest.html;, dataType: jsonp, success: function(data, textStatus) { alert(data.object1); }, error: function(xhr, ts, err){ alert('error' + err); } }); /*$.getJSON(http://www.simplifieddesign.biz/jsonTest.html? callback=?,function(json){ alert(JSON DATA); }); */ As you can see I am trying both ways. Really I guess they are the same. I tried to put the same alert on both tries and it didnt work then I tried just calling an alert and the basic string alert does not even pull up. Any help would be appreciated. Thanks
[jQuery] Re: Selector Madness! How to Select all the Text on a Page?
Ok Im stupid Just use $(div#primarycontentcontainer).animate({fontSize: '+=' + sliderStop}); On May 2, 9:00 am, Joe [EMAIL PROTECTED] wrote: Ariel, You are correct. Attempting suggestions now. Thanks guys! Joe On May 2, 8:32 am, Ariel Flesler [EMAIL PROTECTED] wrote: @Jake and @Alexandre He doesn't want the text as a single string, he wants each node so he can replace them. -- Ariel Fleslerhttp://flesler.blogspot.com On 2 mayo, 10:30, Alexandre Plennevaux [EMAIL PROTECTED] wrote: i think you will need to feed a variable, because jquery loops through each node, so: var fullText =''; $('body *').each(function(){ fullText += $(this).text(); }); On Fri, May 2, 2008 at 3:24 PM, Jake McGraw [EMAIL PROTECTED] wrote: ah why not try $(body).text() That should strip all of the markup? - jake On Fri, May 2, 2008 at 8:55 AM, Joe [EMAIL PROTECTED] wrote: Okay I have read and rereadhttp://www.learningjquery.com/2006/11/how-to-get-anything-you-want-pa... and http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-pa... and still cannot figure out how to grab all the text (not the markup) on a page. I am toying with the Google Translation API and am attempting to parse all text, translate, and put it back. I have the looping logic (and the 500 char limit issue with Google) sorted out, but I can't get the fundamental part down...GRABBING ALL THE TEXT. So let's say you have markup like so ul lia href=somelinkblabh blah 1/a/li lia href=somelinkblabh blah 2/a/li lia href=somelinkblabh blah 3/a/li /ul and even h1some heading/h1 and pSome paragraph text/p etc. etc. I want to be able to grab all the text and manipulate it. I've tried $(#mainContainerDiv *).each(...some function), but this crashed the system. I would like to do something like this: $(#mainContainerDiv *.text.each(some function...), but this clearly won't work. Any help is greatly appreciated. -- Alexandre Plennevaux LAb[au] http://www.lab-au.com-Ocultartexto de la cita - - Mostrar texto de la cita -
[jQuery] Re: Selector Madness! How to Select all the Text on a Page?
I am having the same kind of problem. I am trying to select all the text inside a content div that has many div, p, a, ect.. all located nested inside the div and I do not want any other text except the text inside the content div. I tried $(*).not(div#printercontrol, div#footer).annimate({fontSize: '+=' + sliderStop}) If I leave out the not() then it works but I want to selected everything but the two divs. From what I read above should I write it like this $ (div#primarycontentcontainer).text().annimate({fontSize: '+=' + sliderStop}) Thanks On May 2, 9:00 am, Joe [EMAIL PROTECTED] wrote: Ariel, You are correct. Attempting suggestions now. Thanks guys! Joe On May 2, 8:32 am, Ariel Flesler [EMAIL PROTECTED] wrote: @Jake and @Alexandre He doesn't want the text as a single string, he wants each node so he can replace them. -- Ariel Fleslerhttp://flesler.blogspot.com On 2 mayo, 10:30, Alexandre Plennevaux [EMAIL PROTECTED] wrote: i think you will need to feed a variable, because jquery loops through each node, so: var fullText =''; $('body *').each(function(){ fullText += $(this).text(); }); On Fri, May 2, 2008 at 3:24 PM, Jake McGraw [EMAIL PROTECTED] wrote: ah why not try $(body).text() That should strip all of the markup? - jake On Fri, May 2, 2008 at 8:55 AM, Joe [EMAIL PROTECTED] wrote: Okay I have read and rereadhttp://www.learningjquery.com/2006/11/how-to-get-anything-you-want-pa... and http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-pa... and still cannot figure out how to grab all the text (not the markup) on a page. I am toying with the Google Translation API and am attempting to parse all text, translate, and put it back. I have the looping logic (and the 500 char limit issue with Google) sorted out, but I can't get the fundamental part down...GRABBING ALL THE TEXT. So let's say you have markup like so ul lia href=somelinkblabh blah 1/a/li lia href=somelinkblabh blah 2/a/li lia href=somelinkblabh blah 3/a/li /ul and even h1some heading/h1 and pSome paragraph text/p etc. etc. I want to be able to grab all the text and manipulate it. I've tried $(#mainContainerDiv *).each(...some function), but this crashed the system. I would like to do something like this: $(#mainContainerDiv *.text.each(some function...), but this clearly won't work. Any help is greatly appreciated. -- Alexandre Plennevaux LAb[au] http://www.lab-au.com-Ocultartexto de la cita - - Mostrar texto de la cita -
[jQuery] Re: Hide/Close div when clicked outside of it.
Let me see if I have this clear. Once I do I will write you up a script. When someone clicks a link a href=#Show Login Box/a you want to display a div that shows the login box. When someone clicks somewhere else on the screen and not on the link you want to hide the login box? On May 1, 5:08 am, Aleksandr [EMAIL PROTECTED] wrote: I still have the same issue. Yes, I have wrapper div how it can be solved in this case? Thanks On Apr 30, 7:05 pm, Wes Duff [EMAIL PROTECTED] wrote: Off the top of my head --- Try something like this $('div#mydiv').clcik(function(){$('div#mydiv').show();}); //click to show div $('div:not(#mydiv)').click(function(){$('div#mydiv').hide()}); click anywhere else to hide div ## Problem just thought of If you are using a wrapper div then you will have the same problem as before. Well you get the idea. This is just off the top of my head but if it donst work you get the idea. On Apr 30, 11:17 am, Aleksandr [EMAIL PROTECTED] wrote: Hi All, I am showing a div on click of a hyperlink. Now, when i click elsewhere in the document other than the div itself, then i want to hide the showing div... Is there any easy way to do this? I've already try: $('html').click(function() { $('#divLoginBox1').hide(); }); and $('body').click(function() { $('#divLoginBox1').hide(); }); but this close div when clicked inside of it. Thanks, Alex
[jQuery] Very Challenging (Drop-Drag) Text Resize Scroller
Hello everyone, I am in the process of creating a Text Resize Scroller for my employer. I have the skin created which consists of a background image that looks like a stretched out Less than symbol “” with a vertical rectangular handle to scroll left and right to make the text grow Or shrink. Here is what I had in mind. First set variables Var 1. current text size Var 2 . how much to increment the text size when dragged to the next area of the scroller Var 3. scroller snap in areas (so we know how much to scroll by when the user drags the mouse) Set a function to do drop and drag Set snap in areas of incrementing and de incrementing the handle of the scroller Depending on where the handle came from should tell the function to either grow the text or shrink the text If that isn’t tricky enough, when the user has selected the text size they want they click the save button. The save button then needs to dynamically change the css media=”print” so when the user prints the webpage The user will see the larger print they chose on the webpage. To dynamically change the css for the media=”print” I was thinking of just doing a style type=”css/text” at the Top and use JQuery to access these attributes and change the text size. Any help on getting the idea down will be great. I know many of us are up for a great challenge and when this Script is done and in working order I will post the final script and images so everyone can use it. Thanks
[jQuery] :contains( I WANT TO USE A VALUE HERE NOT A STRING ) well the value is a string
Does anyone know a work around or how to add a value to :contains. Here is my code I am working with $('.printer_element h2').each(function (i) { if($(this).nextAll().size() 0) { //do nothing } else { //Here we hide the whole div from the browser. We use display none so the divs below the hidden div can move up into the next higher position $(this).parent().css({ display:none}); //next we need to hid the checkbox and link in the page layout for the hidden printer_element //first we asign the name of the hidden printer_element to a variable var hidden_div = $(this).text(); //Now we select the link of the corresponding text and remove it $('ul#list_container a:contains(hidden_div)').remove(); } }); I would like to use hidden_div variable inside of they :contains() when searching through my links I would like to do this dynamicaly but it looks like I might have to write redundant code to check all of my links. Thanks for the help.
[jQuery] Re: Hide/Close div when clicked outside of it.
Off the top of my head --- Try something like this $('div#mydiv').clcik(function(){$('div#mydiv').show();}); //click to show div $('div:not(#mydiv)').click(function(){$('div#mydiv').hide()}); click anywhere else to hide div ## Problem just thought of If you are using a wrapper div then you will have the same problem as before. Well you get the idea. This is just off the top of my head but if it donst work you get the idea. On Apr 30, 11:17 am, Aleksandr [EMAIL PROTECTED] wrote: Hi All, I am showing a div on click of a hyperlink. Now, when i click elsewhere in the document other than the div itself, then i want to hide the showing div... Is there any easy way to do this? I've already try: $('html').click(function() { $('#divLoginBox1').hide(); }); and $('body').click(function() { $('#divLoginBox1').hide(); }); but this close div when clicked inside of it. Thanks, Alex
[jQuery] Re: :contains( I WANT TO USE A VALUE HERE NOT A STRING ) well the value is a string
Yea saw that thanks guys. I found the answer right after I sent this out. Should have looked first. Thanks for the response though. On Apr 30, 8:21 pm, Karl Swedberg [EMAIL PROTECTED] wrote: $('ul#list_container a:contains(' + hidden_div' + )') Hey Hamish, Looks like you switched a quote and a plus around. Should be: $('ul#list_container a:contains(' + hidden_div + ')') Cheers, --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Apr 30, 2008, at 3:38 PM, Hamish Campbell wrote: First of all, in this: $('ul#list_container a:contains(hidden_div)') The word 'hidden_div' is just a string literal - ie it's just looking for the word hidden_div. If you want to look for the text you've assigned to the _variable_ hidden_div you just need to go: $('ul#list_container a:contains(' + hidden_div' + )') That may or may not be the best way of doing it, but I think it is what you intended to write. On May 1, 6:00 am, Wes Duff [EMAIL PROTECTED] wrote: Does anyone know a work around or how to add a value to :contains. Here is my code I am working with $('.printer_element h2').each(function (i) { if($(this).nextAll().size() 0) { //do nothing } else { //Here we hide the whole div from the browser. We use display none so the divs below the hidden div can move up into the next higher position $(this).parent().css({ display:none}); //next we need to hid the checkbox and link in the page layout for the hidden printer_element //first we asign the name of the hidden printer_element to a variable var hidden_div = $(this).text(); //Now we select the link of the corresponding text and remove it $('ul#list_container a:contains(hidden_div)').remove(); } }); I would like to use hidden_div variable inside of they :contains() when searching through my links I would like to do this dynamicaly but it looks like I might have to write redundant code to check all of my links. Thanks for the help.
[jQuery] Re: count lis within a ul.
I dont know if this is right or not but every time you use a function you should end it with () and (param1, param2, paremEnd) if you have parameters. So shouldnt it be $(div.belt ul li).length(); On Apr 30, 7:04 pm, Dave Methvin [EMAIL PROTECTED] wrote: right now i am using this: it seems to return the total width of the li's or something. why isnt there some kind of countFirstGenerationChldren prototype? :P var itemLength = $(div.belt ul li).length; Looks like it should work; can you show your markup?
[jQuery] Re: slideUp slideDown and mouseover mouseout
Hello, If you want the div to scroll up when you move the mouse over a sertain div you could use the hover() function but here is a quick example of mouse events $(function(){ //first hide the button div $('div#buttonDiv').hide(); //here set a hover to show roll on and roll off and while on access button div and slideDown and roll off slideUp() taking 4 seconds for both $(div#textDiv).mouseover( function () { $(div#buttonDiv).slideDown(2000); }); $(div#textDiv).mouseout( function () { $(div#buttonDiv).slideUp(2000); }); }); /script style type=text/css #container {border:1px solid #FF;} #textDiv {color:#006600; border:#00 2px solid;} #textDiv h1 {font-weight:bold; color:#656565;} #textDiv p {padding:0;} #buttonDiv {padding:10px 0 0 0; background-color:#99CC00} /style /head body div id=container div id=textDiv h1My DIV/h1 pWhen user rolls over this div show button/p /div div id=buttonDiv input type=button value=MyButton/ /div /div I didnt check it out but if it dosnt work well you get the idea On Apr 30, 2:34 pm, Waters [EMAIL PROTECTED] wrote: Hi all - new to jQuery - a case of trying to run before I walk for sure... But.. can anyone help with this? I have a container div - and two nested divs: one for text, and another with button (will become part of a resultset) I'd like the button div to show with the slideUp and slideDown functions when the mouse is over the containing div. The trouble I'm having is handling the mousout events - and keeping the button containing div visible if they move over into this div. The source is short, and can be viewed at... http://www.dotbits.com/reveal_buttons.html Any suggestions greatly appreciated...