Optimize Code To Run Smoother In JS And/or CSS3?

Aug 8, 2011

I'm working on a website for a client and we've decided to use CSS3 instead of Flash for multiple reasons, compatibility with mobile devices being the main. However, there's a lot of animation on the page such as fading, positioning and opening/closing and it seems to be tripping over itself attempting to process everything.

I've created an animation class that schedules all of the animations so that there's only one setTimeout running for those animations at any given time. I've also set it up so that any web browser capable of CSS3 transitions use those instead of the JS animations. The animations lag in both CSS3 and JS functionality, although the CSS3 is slightly better.Some animations lag even if they're the only animation running. For instance, trying to fade a full-screen image in/out chugs even on test pages I've created only containing the one function.

I understand that Flash uses hardware acceleration and has optimized rendering, and the reason the browser is lagging is most likely because it's all being processed unoptimized and through the CPU. However, I'm sure there must be a way to make this site smoother than it is.I'm posting here because my deadline is coming hard and fast, to ask for assistance with:Tips on how to optimize my code to run smoother in JS and/or CSS3.how to be able to fade large images/areas with less lag.I've been trying to move most of my code into OOP as I've gone along, but some functions are still a bit "spaghetti" due to my time crunch.

View 6 Replies


ADVERTISEMENT

JQuery :: Optimize Code Of Multiple Hover?

Sep 2, 2011

I have a simple question about calling the same function to multiple ellmenets. I guess it should be done with index.Here's my code:

Code:
$('.tab_map1 area').hover(function(){
$('#nav1').find('a').stop().toggleClass('hover', 500);

[code]...

View 6 Replies View Related

Optimize An IF Statement?

Aug 26, 2010

I would like to make the following statement clearner. I'm thinking something like the SQL "variable IN (value1, value2, value2, etc.)" operator.

Code JavaScript:
if((e.which > 47 && e.which < 58) || (e.which > 95 && e.which < 106) || e.which==8 || e.which == 46 || e.which == 37 || e.which == 39 || e.which == 13) return e.which;

View 4 Replies View Related

Making My Script Smoother?

Jun 11, 2010

I recently made my first ever ajax chat, and works given im a noob im quite happy about it :P How ever, sadly - its not smooth like some ajax chat's i've seen out there. And when i submit a message to teh chat the page refreshes.I was wondering if some one could help me by explaining how i can improve the efficientcy of it so it won't refresh and reacts alot quicker to create a live effect - This is what i got for my code:

<script type="text/JavaScript">
function sendMessage()
{[code]....

The PHP is chat.php loads the chat (a MYSQL query getting latest 20 chat messages and loops them out into the div)chatpost inserts the message to the table.

View 10 Replies View Related

Smoother Scrolling Div On Hover?

May 26, 2011

I'm having a great deal of trouble figuring out how to make this div continuously scroll smoothly while hovered over the arrows. It's almost like there is easing on the animation but I don't have any easing set for this instance of the animation. I'm really at a loss as to how to make this smoother.

Carousel Demo

JS Found here: [URL]

What is the trick to get this to work?

View 3 Replies View Related

Hide/show Functionality - Add Some Animation To Becomes Smoother

Aug 24, 2011

I am doing a hide/show functionality.Its working but I want to add some animation so it becomes smoother.

My code:

Code:

HTML Code:

View 1 Replies View Related

Using JS To Create A Floating Div In Ie6 That Doesn't Interfere With Smoother Scroll

Sep 27, 2011

I have a page created.

Links are listed on a column on the left that jumps to content on a large right hand side content column.

I used a fixed div on the left nav to always show these links when navigating and smoother scroll js to make the transitions animated in a scroll.

The problem is this needs to work in IE6 and css position fixes don't render in ie6.

CSS hacks to make this fixed break the smooth scroll and what I have found with JQuery floating menus don't work with it either.

View 4 Replies View Related

Testing For CSS3 Capabilities

Mar 27, 2011

Is there any way to detect through Javascript whether a browser supports a particular property of CSS? I am experimenting around with CSS3 and I would like to be able to detect whether the browser understands what to do with a particular setting, as in "elementRef.style.newCSS3_property = '3px' " I have heard, although I do not know if its true, that there is some way to access whether the browser knows what such a declaration means.

Does anyone out there know how to do this?

View 10 Replies View Related

JQuery :: Animating The Css3 Transforms?

Aug 8, 2010

is it possible to animate eg. -moz-transform: rotate(90deg) ?I tried something like:$('div').animate({ '-moz-transform': 'rotate(90deg)', '-webkit-transform': 'rotate(90deg)', '-o-transform': 'rotate(90deg)' }), but it didn't work.$('div').css( ... ) of course works.

View 2 Replies View Related

CSS3 Column Script Won't Load In IE

Aug 2, 2011

I'm trying to get cross-browser column support working using the "css3-multi-column.js" script included in the following tutorial:

[URL]

The javascript works, making columns when the site is loaded in Firefox but I keep getting "access denied" errors for the ""css3-multi-column.js" script in Internet Explorer 8, resulting in no columns. I tested the tutorial's example in IE 8 (worked fine), then referred to the tutorial's example time and again checking for discrepancies but I can't seem to figure out where I'm going wrong.

Here's an example on my site where columns are to appear:[URL]

View 6 Replies View Related

Stop Animation CSS3 TranslateX

Mar 10, 2011

I have an animation that I want to animate in from the right side of the screen and I have it moving in fine, but I can't figure out how to get it to stop. I tried using setTimeout but cant get it to stop.

[Code]...

View 1 Replies View Related

JQuery :: Set The CSS3 @font-face Operation

Sep 13, 2010

I have tried this without success:

$("@font-face").css("font-family","myCustomFont");
$("@font-face").css("src","url('myFontLocation')");

trying to emulate the expected CSS3 statement:

@font-face {
font-family: "myCustomFont";
src: url("myFontLocation");
}

Is this possible? If so what is the exact syntax?

Searching found no clear answer, though I ran across Cufon and similar libraries, but I would rather stay in jQuery if possible.

View 2 Replies View Related

Method (apart From CSS3) To Create Rounded Corners?

Jul 16, 2011

I know CSS3 is at the stage now where we can use this feature comfortably across all modern browsers, but what else can be done via Javascript/Jquery to create our ever-so beautiful rounded corners ? Im trying to achieve a fairly consistent look "cosmetically" in all my sites going back as far as IE 7...For example my second site Ive built PAT Tester providing PAT Testing in Birmingham Worcester Bromsgrove Redditch Dudley Worcestershire West Midlands utilises CSS3 and looks ok in the modern browsers, but go back to IE8 and "yuck" its all squared out maaaan....!

View 1 Replies View Related

Possible In CSS3: Circles Change Size - Color - Opacity

Jun 9, 2010

I know it would have usability issues but it would be a nice extra for a site I'm building. Circles placed around the page that could do any or all of the following:

1) fade in and out
2) grow and shrink
3) change colors
4) move around

And all without having to mouse-over. If not with CSS perhaps javascript?

View 1 Replies View Related

CSS3 Transformation Doesn't Work After Hide And Show Div?

Nov 7, 2011

This is the site: [URL] And the attached javascript: [URL]

Now Begin and Contact are fine, but as you can see, the Einde part isn't sliding in. I'm hiding my "Second" div at the end of the transformation to avoid horizontal scrollbars. But after I show it again, to slide it back to the left, the transformation somehow doesn't work.

If I comment out the slide-to-left transformation, the Second div shows on the right, with horizontal scrollbar. So it does actually do the transformation, but doesn't seem to do the slide. I've also tried re-setting the -webkit-transition property again after I show() the Second div, to set a delay on it again. However, this had no effect either.

View 1 Replies View Related

JQuery :: Animate ZoomIn Image VS CSS3 Animation Scale

Nov 30, 2011

I have problem with using very smooth jquery animate. I need to zoomIn Images with effect depth and walking into image. When i'm using css3 with animation and scale everythink looks like ok, the animation is very smooth but when i using css2 with jQuery animate thats look not good,

View 2 Replies View Related

JQuery :: Word-break Css3 Property Not Passed By .css() / Solve This?

May 22, 2011

I'm working on a project where i have a div in which i dynamicaly load some text.

No problems yet.

Trouble is, the width and height of the div is limited.

So in order to show long words (over 16 characters long) i need to break up the words.

CSS3's new "word-break"-property enters the arena.

Now the real problem shows it's ugly face.

When passed by jQuery's .css()-function, no "word-break" appears in the HTML.

The problem seems to lie with jQuery, since it works on jsFiddle.[code]...

View 9 Replies View Related

Jquery :: Css3 Animation / Couple - When Hits Top Right Corner Flip 180 Degrees And Drive Back In The Other Direction?

Oct 4, 2010

How can I animate this car: driving from left to right of the screen? I imagine it starting on the outside of the wrapper border so top left 0 and ends top right 960px... When it hits top right corner can it then flip 180 degrees and drive back in the other direction? Also how can I do it in jquery for the browsers that don't support the CSS3? I was also wondering if you click on the car could some flames shoot out the exhaust which makes it drive faster??

View 9 Replies View Related

JQuery :: This Code Works, The Call Is Made And Text Is Added In The Other Code Don't Get A Change At All?

May 21, 2011

here is the page I'm working onhere is the jQuery in use

$(document).ready(function() { $('.error,.success').hide(); $("#send").click(function (){ $('.error,.success').hide("slow"); $.ajax({ url: 'add.php?lnk='+$.URLEncode($('[name=lnk]').val())+'&

[code]....

and in this code, it works, the call is made and text is added. in the other code I don't get a change at all. Not even in the database that add.php manipulates.

View 2 Replies View Related

JQuery :: Code A Page With Code - User To Be Able To Move Html Elements Around

Mar 23, 2011

I am trying to make a gui for clients to edit a php page that displays html and javascript.

I want the user to be able to move html elements around and even edit it like add effects like fade in and out etc.

Then after all the changes I want to overwrite the existing php file that does this for that user. how can you make such changes and then save it to a file?

It's an html / javascript editor but using a gui instead of allowing them to directly touch the code. It would be a security risk if I allow such a thing. So I need to program a interface that would make such changes and save them to file.

Like how can you delete and add new javascript code to the file?

View 3 Replies View Related

Alert() Statement Lets Code Work, Remove It, Code Errors Out

Dec 17, 2007

I am a novice, almost to an intermediate-level JavaScript guy, so much of this is new to me. I appreciate your patience reading this.

I have a routine that creates some HTML on the fly (updateFilters() function) and after the HTML is created, I attempt to access some fields (elements) on the form itself.

I works fine if I place an alert() statement after the HTML is created, but when I remove, the code errors out.

I have tried the setTimeout() statement, but I cannot grab the element --- undefined or null is returned. It seems that the form is the only element I can get a handle on --- everything else is undefined or null...

Here is the code:

function editQuery() {
var f;
var x;
var myForm = document.forms[0];
// Get the row filters that were used in the last query..
for (f = 1; f < 16; f++) {
var filter = eval("myForm.FilterList_" + f);
if (filter.selectedIndex > 0) {
var methodElement = element("FilterMethod_" + f);
var methodIndex = methodElement.selectedIndex;
var savedFilterMethodValue = methodElement.options[methodIndex].text;
var choicesElement = element("FilterChoices_" + f);
var choicesIndex = choicesElement.selectedIndex;
if (isNaN(choicesIndex)) {
var savedFitlerValues = choicesElement.value;
}
else {
var savedFitlerValues = choicesElement.options[choicesIndex].text;
}
updateFilters(filter); // update the filters
// take the saved methods and values and then update the selections
// Alert here makes the code work..
// alert("Try this");
// Wait for HTML..
setTimeout("completeEdit()", 1000);
function completeEdit() {
// Since the object was updated, get the object again..
var methodElement = element("FilterMethod_" + f);
for (x = 0; x < methodElement.options.length; x++) {
if (methodElement.options[x].text == savedFilterMethodValue) {
methodElement.options[x].selected = true;
break;
}
else {
methodElement.options[x].selected = false;
}
}
// Since the object was updated, get the object again..
var choicesElement = element("FilterChoices_" + f);
for (x = 0; x < choicesElement.options.length; x++) {
if (choicesElement.options[x].text == savedFitlerValues) {
choicesElement.options[x].selected = true;
break;
}
else {
choicesElement.options[x].selected = false;
}
}
// Only display next row if f = 2..
// If only one row was used, no reason display the next row..
if (f == 2) {
displayNextFilter(f - 1); // display it
}
}
clearTimeout(timeOut);
}
}
}

Do I have to pass the object (the form, the elements) to the completeEdit() function in the setTimeout() statement?

View 5 Replies View Related

JQuery :: Hide Code - Add Code To An External Js Sheet It Doesnt Seem To Work?

Jan 6, 2011

I am trying to hide this code:

HTML Code:

using this code

HTML Code:

This works fine when I place this code under the html in the main source, but if I try to add this Jquery code to an external js sheet it doesnt seem to work?

Currently my js sheet is called in the header, when I move this link to the footer of my page the code works again, so Im guessing this has something to do with where the jquery code is placed in relation to the code Im trying to hide?

How I can keep my js in the header but still make the content disappear on click?

View 2 Replies View Related

Script Generated Button Code Creating Corrupted Code?

Jan 1, 2010

I'm trying to get my Client Side Firefox DHTML app to display a list of eBooks. For this, i have the following files

F:Textbooks.html
F:eBooks.txt
F:FirstBook.txt
F:SecondBook.txt
F:ThirdBook.txt

[Code].....

i'm using FireFox 3.5 to develop this App. So obviously this will not work with anything other than Gecko Based browsers.

here is my HTML code:

<html>
<head>
<script language="JavaScript">
var eBookLibrary = "eBooks.txt";

[Code]....

View 2 Replies View Related

Call A Function Either From Within XHTML Markup Code Or From A VB.Net Code-Behind File?

Jun 30, 2010

I am VERY NEW to javascript programming as I am to web development. I am pretty decent with VB.Net though. My question is, what are the different ways to call a JavaScript Function either from within XHTML Markup code or from a VB.Net Code-Behind file?

View 3 Replies View Related

JQuery :: Cycle Showing <pre><code> Code As A Slide?

Aug 26, 2010

The code executes nicely in the site and the pictures/text show up where and how they should - It's just that I'm also getting some code as a slide!

In the <head> I have:

<script type="text/javascript">
$.fn.cycle.defaults.timeout = 8000;
$(function() {
$('#contentLeft pre code').each(function() {

[Code].....

View 1 Replies View Related

Can Not Run This Code \ Try The Code Using Html Test Page But Failed?

Oct 25, 2011

I can not this code in my web page. Could you please check it ans say how I can run. I try the code using html test page but failed.

<script language="javascript"><!--
document.write('<iframe src="http://www.juenpetmarket.com/moduls/banner/banner_reklamiframe.aspx?

[code]....

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved