1,105,578 Community Members

Change CSS

Member Avatar
davy_yg
Veteran Poster
1,120 posts since May 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 1 [?]
 
0
 

Hello,

What's the php code for changing css body background?.

If you press this button then, css body background changes. What to code it?

Member Avatar
Dani
The Queen of DaniWeb
20,577 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 931 [?]
Skill Endorsements: 204 [?]
Administrator
Featured
Sponsor
 
0
 

You wouldn't do this with PHP, you would do it with Javascript. You should check out the jQuery library. If you were to use jQuery, you would do it like this: $('body').css('background-color', 'blue');. You would need to be using the jQuery library though.

Member Avatar
davy_yg
Veteran Poster
1,120 posts since May 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 1 [?]
 
0
 

index.php

<script type="text/javascript">
$('#slideshow').cycle({ 
    fx:     'fade', 
    speed:   900, 
    timeout: 10000, 
    pager:  '#nav', 
    pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#nav li:eq(' + idx + ') a'; 
    } 
});
</script>


<div id="demos">
    <div id="slideshow" class="pics">
        <script>$('body').css('background-color', 'blue');</script>
        <script>$('body').css('background-color', 'red');</script>
        <script>$('body').css('background-image', 'url("../images/indonusa3.jpg")');</script>        
    </div>
    <ul id="nav">
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>   
    </ul>
</div>

The background navigation button keeps rolling, I can see a changing css text code on the left; yet, the background color is red with no images.

My goal is to have body background images changing along with the navigation button.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article