Skip to content

Instantly share code, notes, and snippets.

@lazypower
Created June 26, 2011 16:28
Show Gist options
  • Save lazypower/1047749 to your computer and use it in GitHub Desktop.
Save lazypower/1047749 to your computer and use it in GitHub Desktop.
Jquery Failing to strip html, and show visible info
@using CCBlog.Classes
@model IEnumerable<CCBlog.Classes.LastFmWrapper.Track>
@{
ViewBag.Title = "About Me";
}
<script type="text/javascript">
$(document).ready(function () {
// click on album art event
$("ul.lfm-thumb li").click(function () {
$('#lfm-feature').empty();
var copy = $(this).clone();
copy.find('li')
.remove()
.end();
alert(copy);
$(copy).appendTo('#lfm-feature');
copy = $(this).next().clone();
copy.css('display', 'block');
$('#lfm-feature').append(copy);
});
// mousing functions to do the fancy zoom animation
$("ul.lfm-thumb li").hover(function () {
if ($(this).hasClass("lfm-lefborder")) {
marTop = '110px';
marLeft = '110px';
} else {
marTop = '-110px'; /* vertically align this image */
marLeft = '-110px';
}
$(this).css({ 'z-index': '10' }); /*Add a higher z-index value so this image stays on top*/
$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
.animate({
marginTop: marTop,
marginLeft: marLeft,
top: '50%',
left: '50%',
width: '174px', /* Set new width */
height: '174px',
padding: '20px'
}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */
}, function () {
$(this).css({ 'z-index': '0' }); /* Set z-index back to 0 */
$(this).find('img').removeClass("hover").stop() /* Remove the "hover" class , then stop animation queue buildup*/
.animate({
marginTop: '0', /* Set alignment back to default */
marginLeft: '0',
top: '0px',
left: '0px',
width: '100px', /* Set width back to default */
height: '100px', /* Set height back to default */
padding: '1px'
}, 400);
}); // end of animation
});
</script>
<div id="text_header">
<div class="content">
<h1>About</h1>
</div>
</div>
<!-- End text header -->
<!-- Begin page content -->
<div id="page_content">
<div class="full_width">
<!-- lfm data -->
<div id="LFM-Mod-Container">
@* Iterate over the Last.FM data and display it in an attractive format *@
@foreach (var group in Model.Select((x, i) => new { Group = i / 3, Item = x }).Take(9)
.GroupBy(x => x.Group)) {
<ul class="lfm-thumb">
@foreach(var x in group) {
<li>
@if (x.Item.image != string.Empty) {
<img src="@x.Item.image.ToString()" class="lfm-artwork" alt="@x.Item.album"/>
} else {
<img src="/Content/images/lfm/NoAlbumArt.jpg" class="lfm-artwork" alt="No Album Art Available" />
}
</li>
<span class="lfm-feature-info" style="display: none;">
<br />Title: @x.Item.name
<br />Artist: @x.Item.artist
<br />Album: @x.Item.album
</span>
}
</ul>
}
<div id="lfm-feature">
</div>
</div> <!-- /LFM-Mod-Container -->
<!-- /lfm data -->
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment