I'm trying to use AJAX (not jQuery).... I basically have this going on.
Content A Title
Content A Full
HR
Content B Teaser
Content C Teaser
Content D Teaser
Html/CSS Example of State A
I have the before and after CSS, but I'm having trouble finding example code that actually alters CSS. Instead, I'm finding tricks like 'adding a class' and stuff that people use to simply hack the CSS. So, I think maybe I'm starting in the wrong place.
I'm using Php 5 and MySQL, if you want to be really helpful. I'm not worried about that, though, as I'm presently working on it, myself. What I'm SUPER interested in is figuring out how to create this, without having the page refresh:
Content C Title
Content C Full
HR
Content A Teaser
Conte开发者_运维问答nt B Teaser
Content D Teaser
HTML/CSS Example of State B
I think you are looking for something like THIS. It is possible with Javascript to copy DOM elements or move them... Read something about cloning and deleting nodes with JS(clone node method described HERE)
You can use [element.setAttribute][1]("*style*", "*value*")
. You can target the CSS [document.querySelector][2]("*target*")
to select the div class or id or what-have-you.
You can use jQuery, like so: $('*target*').css('*style*', '*value*')
.
There doesn't seem to be a short-hand AJAX equivalent.
Sample arguments:
Style: "align", "background-color". Value: "center", "blue". Target: "#myDiv", ".myDiv", "p"
精彩评论