Jump to content

piearcy

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by piearcy

  1. Absolutely understand. I'm getting 4 errors after removing 1.11.2. All saying different things are not a function. Of of which is $elem. I've read the use of $ is no good with Magento and also read to wrap it as such, $($elem) but his had no effect. Nor does using jquery instead of $. a(document).on is also not a function in bootstrap.js. Then some individual things like owl slider is not found.
  2. Summary, I have a Magento site which was loading about 7 different varieties of jQuery. We want to cut them down to a single library. These ranged from 1.10.1 to 2.1.4. So we have chosen to use 2.1.4 and then fix the errors that come up. This being said, I'm down to a few but now am getting the errors that need correcting. I'm not at ALL a jQuery expert but choose to write in native javascript whenever possible as I'm not a fan of libraries if it can be done natively saving kb's. But this does not help me now as I'm having the afore mentioned errors and not being a jQuery expert I'm not certain what I need to do next. www.dev.michaeltoddusa.com. This is the shortest way for you to look at the source code and let me know where I need to start. Any help is appreciated.
  3. I was thinking this is what is going on. A plugin is calling for the library before it's actually loaded. Thanks. Love the signature. :-)
  4. I should add the other errors are 'undefined is not a function' and 'n is not a function'.
  5. I took on the daunting task of reducing the size of a Magento site. Beast that. At any rate, I have 3 different jQuery libraries loading. 1.10.1, 1.11.1, and 2.1.3. Then 2 different migrates which I would think would fix migration issues if I removed the two older versions. But just removing 1.11.1 gives me the error of 'jQuery is not a function, jQuery is not defined.' many times. Understanding no conflict is being used which should kill $ but not jQuery? What is the easiest way for me to migrate to using solely 2.1.3 and killing off the other two libraries? Perhaps a change log to see what has been removed since 1.10.1 and 1.11.1? I'd appreciate any advice on this one as I'm a php developer and write in jQuery but it is not my forte. Thanks
  6. Thanks guys. Both worked of course but the later was shorter than the former. I knew it would be easy. Appreciate it as always.
  7. I need multiple json files written by their ID number. I call the id separately and also include it in the json file I'm writing. But when I'm writing I'm writing ALL the records in each .json file and not the individual records. I know I'm just overlooking something but anyone? Here's the code. while ($row = $result->fetch_assoc()) { $myArray[] = $row; $message = json_encode(array($myArray)); $id = $row['id']; $myfile = fopen("message/$id.json", "w") or die("Unable to create file!"); fwrite($myfile, $message); fclose($myfile); } Thanks
  8. Just looking over it quickly I'm assuming the function PageMain is being called elsewhere and this is what is breaking your page.
  9. id is the primary key and description is a unique key. I had already looked at those. You have a point and I agree that's what's happening. Now I have to look at this further to figure out why he made description unique. Thanks!
  10. Not sure why this isn't working so thought I would see if others laying eyes on it will see the problem. mysqli_query($mysqliConn, 'INSERT INTO '.$table.' (id, description, car_initials, car_no, site_id, product_id, status_code, available_dt) VALUES ('.$id.', '.$description.', '.$carInitials.', '.$carNo.', '.$siteId.', '.$productId.', '.$statusCode.', '.$availableDt.') ON DUPLICATE KEY UPDATE description = '.$description.', car_initials = '.$carInitials.', car_no = '.$carNo.', site_id = '.$siteId.', product_id = '.$productId.', status_code = '.$statusCode.', available_dt = '.$availableDt.' ') or apiError( array( 'index' => $i, 'id' => $id ) ); Description is a combination of the car initials and car number and is placed in a unique key in the MySql database. But I'm getting this: Duplicate entry 'MWCX300310' for key 'description'. I should not be getting this since I'm doing the on duplicate key update. Am I missing something here? And yes I know this is not a prepared statement. I took this project over from another developer and am in the process of changing everything over to PDO to rectify that problem. Thanks, Dave
  11. Yeah. Tried that. Gave up and decided to write longer code but it works. Just made a series of if else statements to determine with selection was selected and then do it's thing. I have no patience. Going to be slower but it is what it is I suppose. The problem with the above is it doesn't select the correct item. Always chooses the last one.
  12. Quick question that I have not been able to find on the internet. Go figure. Can you apply the jQuery :eq(index) to a selection menu? I use it for list items but have been unsuccessful at using it for a selection menu. Probably because they aren't an ordered list? So I've probably answered my own question there. What could I use in it's place for a selection menu? I'm indexing the actual line item referenced to know what to load thusly... $('.tab-content div.tab:eq(' + $('#tab-menu > li').index(this) + ')').slideDown('slow'); Really need to do the same thing with a selection menu but google has not helped me out so far.
  13. Not really because that's not what I'm doing. Odd that Adam has stuff over on that domain though. What Adam is talking about there is swapping content out using jQuery and PHP using Ajax. I'm not swapping out per se. I'm tabbing through data. And with a selection menu I don't need an on click event. I need an on change event for that selection menu to work. I can make it tab through content using the on click event and targeting the <li>. What I'm having trouble with is the on change event targeting the #tab-menu selection. As stated, I printed to console the value I'm getting back with my code and it's correct. The old tab does indeed slide up. What I'm not getting is the new tab sliding up as it should. Thanks though.
  14. I added a console.log just to see what value I'm getting returned. console.log(txt); $('.tab-content div.tab').slideUp('slow'); $('.tab-content div.tab:eq(' + $(txt).index(this) + ')').slideDown('slow'); And sure enough, I'm getting the text of the line item. So my problem has to be with the last line. $('.tab-content div.tab:eq(' + $(txt).index(this) + ')').slideDown('slow'); I've tried changing (txt) to (this) and (this) to (txt) and different variations and still can't get it to do what I want it to do.
  15. Perhaps I had too much code in the first or maybe not enough. First, here is the HTML. <ul id="tab-menu"> <li>link1</li> <li>link2</li> <li>link3</li> <li>link4</li> </ul> The relevant parts of the jQuery which work for my line items... $('#tab-menu > li').click(function(){ $('.tab-content div.tab').slideUp('slow'); $('.tab-content div.tab:eq(' + $('#tab-menu > li').index(this) + ')').slideDown('slow'); (I removed the mouse over and active states etc. from the above so yes, I know I'm not closing the above but that's because I removed code beneath the relevant part) I could have added the )}; but I'm assuming you all know it's there.) I'm making this responsive. I have that menu on the left and making it stay at the top of the page regardless of where you scroll. OBVIOUSLY this will not work for a phone so I get rid of the line items and populate a selection menu. The code is in my original post and that functions as it should. Though I did change it from populating with the links to removing links and populating with the > li. But now I need that tab to work using my selection menu. Here is what I've tried. I get no errors in console but it still does not work. I've tried .html, .attr, .text, .val and all of which do nothing other than slide up the previous but it's not sliding down the tab I'm looking for. Here's what I have currently. $("#tab-menu select").change(function() { var txt = jQuery(this).find("option:selected").html(); $('.tab-content div.tab').slideUp('slow'); $('.tab-content div.tab:eq(' + $(txt).index(this) + ')').slideDown('slow'); }); Of course this doesn't work either. I would love you forever if you can help me here. :-) Thanks
  16. Going to be a bit of code in this one. Basically I have a one page site that I'm using jQuery to navigate the page to make it appear as more than one page. Here is that particular code. $(document).ready(function() { var offset = $("#tab-menu").offset(); var topPadding = 15; $(window).scroll(function() { if ($(window).scrollTop() > offset.top) { $("#tab-menu").stop().animate({ marginTop: $(window).scrollTop() - offset.top + topPadding }); } else { $("#tab-menu").stop().animate({ marginTop: 0 }); }; }); }); $(function() { //Get all the LI from the #tabMenu UL $('#tab-menu > li').click(function(){ $('#tab-menu > li').removeClass('selected'); $(this).addClass('selected'); $('.tab-content div.tab').slideUp('slow'); $('.tab-content div.tab:eq(' + $('#tab-menu > li').index(this) + ')').slideDown('slow'); }).mouseover(function() { $(this).addClass('mouseover'); $(this).removeClass('mouseout'); }).mouseout(function() { $(this).addClass('mouseout'); $(this).removeClass('mouseover'); }); }); You will also notice I'm keeping that side menu close to the top of the page if you scroll down. This is all well and good. But I need to make this site responsive and the way I do that typically is to create a select menu as follows. $(function() { $("<select />").appendTo("#tab-menu"); $("<option />", { "selected": "selected", "value" : "", "text" : "Go to..." }).appendTo("#tab-menu select"); $("#tab-menu a").each(function() { var el = $(this); $("<option />", { "value" : el.attr("href"), "text" : el.text() }).appendTo("#tab-menu select"); }); $("#tab-menu select").change(function() { window.location = $(this).find("option:selected").val(); }); }); Now my problem runs into that last part there where it's wanting to change window location. So I have removed that part and put in the follow which doesn't seem to work. $(document).ready(function() { $('#tab-menu select').change(function(){ $('.tab-content div.tab').slideUp('slow'); $('.tab-content div.tab:eq(' + $("#tab-menu select").index("option:selected").val() + ')').slideDown('slow'); }).mouseover(function() { $(this).addClass('mouseover'); $(this).removeClass('mouseout'); }).mouseout(function() { $(this).addClass('mouseout'); $(this).removeClass('mouseover'); }); }); Can anyone help me figure out how to make the select menu function properly to go to the tab I'm wanting it to go to just as my <li> elements work when it's full size? If not I'm going to scrap the jQuery and just navigate to different pages because that is easy. Thanks!
  17. Oops. Missed that first one. That did the trick. Thanks so much.
  18. Gotcha. But even changing it to this: require('includes/db_connect.php'); $query = "SELECT * FROM events ORDER BY displayorder ASC"; $result = mysqli_query($db_conx, $query); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $pid = $row["id"]; $title = $row["title"]; $date = $row["date"]; $info = $row["info"]; $linkTxt = $row["linkTxt"]; $link = $row["link"]; $message = "<div id='events_holder'>"; $message .= "<table width='500' border='0' cellspacing='0' cellpadding='10'>"; $message .= "<form action='edit_event_parse.php' method='post'>"; $message .= "<tr>"; $message .= "<td class='prayer_title'>Title:</td>"; $message .= "<td><input type='text' name='title' class='admin_input' value='" .$title."' /></td>"; $message .= "</tr>"; $message .= "<tr>"; $message .= "<td class='prayer_title'>Date:</td>"; $message .= "<td><input type='text' name='date' class='admin_input' value='".$date."' /></td>"; $message .= "</tr>"; $message .= "<tr>"; $message .= "<td class='prayer_title'>Link Text:</td>"; $message .= "<td><input type='text' name='linkTxt' class='admin_input' value='".$linkTxt."' /></td>"; $message .= "</tr>"; $message .= "<tr>"; $message .= "<td class='prayer_title'>Link URL:</td>"; $message .= "<td><input type='text' name='link' class='admin_input' value='".$link."' /></td>"; $message .= "</tr>"; $message .= "<tr>"; $message .= "<td class='prayer_title'>Event Details:</td>"; $message .= "<td><textarea name='info' cols='20' rows='10' class='admin_area'>".$info."</textarea></td>"; $message .= "</tr>"; $message .= "<tr>"; $message .= "<td><input type='hidden' name='pid' value='".$pid."' /></td>"; $message .= "<td><input name='submit' type='submit' value='Edit Event' class='admin_submit'/></td>"; $message .= "</tr>"; $message .= "</form>"; $message .= "</table>"; $message .= "<p> </p>"; $message .= "<hr />"; $message .= "<p> </p>"; $message .= "</div>"; I still only get the last message that overwrote everything else. How can I display all the records in this format without overwriting $message each time? This was easy using mysql. Much more difficult it seems using mysqli now. Still learning.
  19. Indeed on both counts. Thanks.
  20. How come this doesn't loop? Everything is in the while loop. My database connection is in the included file you see to begin the code which is what db_conx refers to just to be clear. Database connection is not an issue nor is getting values. I just get the first one and nothing more. No looping taking place here. What I miss? require('includes/db_connect.php'); $query = "SELECT * FROM events ORDER BY displayorder ASC"; $result = mysqli_query($db_conx, $query); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $pid = $row["id"]; $title = $row["title"]; $date = $row["date"]; $info = $row["info"]; $linkTxt = $row["linkTxt"]; $link = $row["link"]; $message = "<div id='events_holder'><table width='500' border='0' cellspacing='0' cellpadding='10'> <form action='edit_event_parse.php' method='post'> <tr> <td class='prayer_title'>Title:</td> <td><input type='text' name='title' class='admin_input' value='" .$title."' /></td> </tr> <tr> <td class='prayer_title'>Date:</td> <td><input type='text' name='date' class='admin_input' value='".$date."' /></td> </tr> <tr> <td class='prayer_title'>Link Text:</td> <td><input type='text' name='linkTxt' class='admin_input' value='".$linkTxt."' /></td> </tr> <tr> <td class='prayer_title'>Link URL:</td> <td><input type='text' name='link' class='admin_input' value='".$link."' /></td> </tr> <tr> <td class='prayer_title'>Event Details:</td> <td><textarea name='info' cols='20' rows='10' class='admin_area'>".$info."</textarea></td> </tr> <tr> <td><input type='hidden' name='pid' value='".$pid."' /></td> <td><input name='submit' type='submit' value='Edit Event' class='admin_submit'/></td> </tr> </form> </table> <p> </p> <hr /> <p> </p> </div>"; } Thanks!
  21. I keep saying I'm going to have to learn javascript and then the library jQuery but find myself learning Swift now instead. Short one today. I want these two functions to occur back to back. Second function only begins after the first function is complete. $(function() { $('.tlt').textillate(); }) $(function() { $('.tlt1').textillate(); }) If you can please help me with this not only in just code to make that happen but also an explanation of what you did I sure would appreciate it. I've read all morning on promises etc. but have yet to be successful in implementing this. As you can tell I'm using the plug-in textillate to fade text out one letter at a time. Works great! But I have multiple paragraphs I'm wanting to apply this too so I can't make the div class .tlt since I then lose all paragraphs since it's strips it into spans. That would be ideal of course but I think I forced into making different classes for each paragraph. This will become problematic in the future though since the content is generated dynamically and I will have no idea how many paragraphs that dynamic content will contain. So if there was a way to keep my <p> and </p> that would be even better. Thanks!
  22. Good thinking. Appreciate the thoughts and what else you may come up with.
  23. Thanks CroNix, and I agree. I've actually moved the elements and it was indeed jerky. I've done this with both javascript and HTML5 canvas and it had the same effect. The reason I was looking at a fade is because it would look better than simply making the letter disappear, or at least it did in the David example above. I considered a div over the text that comes down and hides with a gradient to transparent to accomplish the fade effect as well but then I'm line by line instead of letter by letter. Unless I have two separate div's working together and I thought that was just crazy. Word by word may work. This is basically a speed reading tutorial and I'm removing text at a certain rate of speed depending on how they scored on the retention test. So I need it to be smooth with a variable I can change the value to either speed it up or slow it down. ANY suggestion as to how accomplish this would be appreciated. Again, thanks for the reply.
  24. I forgot my password for my old account so had to create a new one. New laptop. Anyway, I've searched and searched but can't find a jQuery, javascript or anything else to do what I want to do. I want to fade out all the different paragraphs of a div one letter at a time starting with the first. Here is something CLOSE though the string has to be input. I'm pulling data in from a database with PHP. So not sure if I can target individual letters in different paragraphs. $(function () { var string = " David"; var q = jQuery.map(string.split(''), function (letter) { return $('<span>' + letter + '</span>'); }); var dest = $('#fadeIn'); var c = 0; var i = setInterval(function () { q[c].appendTo(dest).hide().fadeIn(1000); c += 1; if (c >= q.length) clearInterval(i); }, 1000); }); I know I can get my target from a div then split it into characters with something like this: function arrayMe(string) { // For all matching elements $(string).each(function() { var myStr = $(this).html(); myStr = myStr.split(""); var myContents = ""; for (var i = 0, len = myStr.length; i < len; i++) { myContents += '' + myStr[i] + ''; } $(this).html(myContents); }); } Then call the function: $('document').ready(function() { var myStringType = $('.sample-text'); arrayMe(myStringType); }); Where my div as a class of sample-text. (These are just code snippets I have pulled from the net in my search for an answer). But using the fade in which nice in jsfiddle, How can I put all these together to fade out my text a single letter at a time? I'm not sure if different paragraphs will work or not or if I'm going to have to have one long paragraph (bad for my application). Thanks for the help here guys. You've always come through for me before. It's just been awhile since I've been stumped.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.